From 20fc2e210a2a6862f9482793d94c48af7cb25c08 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Wed, 10 Nov 2021 21:00:57 +0800 Subject: [PATCH 1/7] fix: some small bugs --- cli/nnn.sh | 5 ++--- devel/go.sh | 2 ++ gui/pass.sh | 23 ++++++++++++----------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/cli/nnn.sh b/cli/nnn.sh index a27f0fb..1de1da8 100755 --- a/cli/nnn.sh +++ b/cli/nnn.sh @@ -6,7 +6,7 @@ DIR=$(dirname "$(readlink -f "$0")") log 'Setting up nnn' -$NNN_CONFIG_DIR="$XDG_CONFIG_HOME/nnn/plugins" +NNN_CONFIG_DIR="$XDG_CONFIG_HOME/nnn" # setup package mirror for CHINA case "$PM" in @@ -19,13 +19,12 @@ case "$PM" in rm -rf nnn.tar.gz cd - - mkdir -p "$NNN_CONFIG_DIR" + mkdir -p "$NNN_CONFIG_DIR/plugins" HTTPS_PROXY=$GITHUB_PROXY curl -Lo "$NNN_CONFIG_DIR/plugins/fzcd" https://github.com/jarun/nnn/raw/master/plugins/fzcd HTTPS_PROXY=$GITHUB_PROXY curl -Lo "$NNN_CONFIG_DIR/plugins/preview-tui" https://github.com/jarun/nnn/raw/master/plugins/preview-tui ;; pacman) sudo pacman -S --noconfirm --needed nnn - yay -S --noconfirm --needed dragon-drag-and-drop cp -r /usr/share/nnn/plugins/. "$NNN_CONFIG_DIR" esac diff --git a/devel/go.sh b/devel/go.sh index 96184a3..09d24a0 100755 --- a/devel/go.sh +++ b/devel/go.sh @@ -6,6 +6,7 @@ DIR=$(dirname "$(readlink -f "$0")") log "Setting up go" # install go +if ! has_cmd go; then case "$PM" in pkg) pkg install golang -y @@ -19,6 +20,7 @@ case "$PM" in go ;; esac +fi if in_china; then go env -w GO111MODULE=on diff --git a/gui/pass.sh b/gui/pass.sh index 25eaec0..ad38f3d 100755 --- a/gui/pass.sh +++ b/gui/pass.sh @@ -42,15 +42,14 @@ EOF # install browserpass-native +intorepo https://github.com/browserpass/browserpass-native.git "$DIR/repos/browserpass-native" +make configure +make +sudo make install +exitrepo if [ -n "$WSL" ]; then echo "Please download browserpass-native for windows 64 and extract it to /usr/local/bin" x-open https://github.com/browserpass/browserpass-native/releases/latest -else - intorepo https://github.com/browserpass/browserpass-native.git "$DIR/repos/browserpass-native" - make configure - make - sudo make install - exitrepo fi # enable browser-native for google-chrome @@ -60,11 +59,13 @@ fi # chrome extension: https://chrome.google.com/webstore/detail/browserpass/naepdomgkenhinolocfifgehidddafch # enable browserpass for browsers -cd /usr/lib/browserpass -has_cmd chromium && make hosts-chromium-user -has_cmd firefox && make hosts-firefox-user -has_cmd google-chrome && make hosts-chrome-user -cd - +if [ -f /usr/lib/browserpass ]; then + cd /usr/lib/browserpass + has_cmd chromium && make hosts-chromium-user + has_cmd firefox && make hosts-firefox-user + has_cmd google-chrome && make hosts-chrome-user + cd - +fi # android # [OpenKeyChain - encryption/decryption](https://f-droid.org/packages/org.sufficientlysecure.keychain/) From 9d066d71b75617400058c98d6baae82b85d1a388 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Wed, 17 Nov 2021 17:43:09 +0800 Subject: [PATCH 2/7] feat: upgrade tmux to 3.2a --- cli/tmux.sh | 58 +++++++++++++++++++++++------------------------- cli/vim/init.vim | 1 + 2 files changed, 29 insertions(+), 30 deletions(-) diff --git a/cli/tmux.sh b/cli/tmux.sh index fcfb098..6a74c16 100755 --- a/cli/tmux.sh +++ b/cli/tmux.sh @@ -6,37 +6,35 @@ DIR=$(dirname "$(readlink -f "$0")") log 'Setting up tmux' -if ! has_cmd tmux; then - case "$PM" in - apt) - TMUX_VER=3.2 - if ! has_cmd tmux || [ "$(tmux -V)" != "tmux $TMUX_VER" ]; then - sudo apt install libevent-dev libncurses5-dev bison autoconf bc -y - TMUX_SRC_URL=https://github.com/tmux/tmux/releases/download/$TMUX_VER/tmux-$TMUX_VER.tar.gz - #if in_china; then - #TMUX_SRC_URL="https://gitee.com/klesh/tmux/repository/archive/$TMUX_VER?format=tar.gz" - #fi - if [ ! -f /tmp/tmux.tar.gz ]; then - curl -L "$TMUX_SRC_URL" -o /tmp/tmux.tar.gz - fi - rm -rf /tmp/tmux - mkdir -p /tmp/tmux - tar zxvf /tmp/tmux.tar.gz -C /tmp/tmux --strip 1 - cd /tmp/tmux - if [ -f autogen.sh ]; then - sh autogen.sh - fi - ./configure && make - sudo make install - cd - - rm -rf /tmp/tmux +case "$PM" in + apt) + TMUX_VER=3.2a + if ! has_cmd tmux || [ "$(tmux -V)" != "tmux $TMUX_VER" ]; then + sudo apt install libevent-dev libncurses5-dev bison autoconf bc -y + TMUX_SRC_URL=https://github.com/tmux/tmux/releases/download/$TMUX_VER/tmux-$TMUX_VER.tar.gz + #if in_china; then + #TMUX_SRC_URL="https://gitee.com/klesh/tmux/repository/archive/$TMUX_VER?format=tar.gz" + #fi + if [ ! -f /tmp/tmux.tar.gz ]; then + curl -L "$TMUX_SRC_URL" -o /tmp/tmux.tar.gz fi - ;; - pacman) - sudo pacman -S --noconfirm --needed tmux bc - ;; - esac -fi + rm -rf /tmp/tmux + mkdir -p /tmp/tmux + tar zxvf /tmp/tmux.tar.gz -C /tmp/tmux --strip 1 + cd /tmp/tmux + if [ -f autogen.sh ]; then + sh autogen.sh + fi + ./configure && make + sudo make install + cd - + rm -rf /tmp/tmux + fi + ;; + pacman) + sudo pacman -S --noconfirm --needed tmux bc + ;; +esac # symlink configuration lnsf "$DIR/tmux/tmux.conf" "$HOME/.tmux.conf" diff --git a/cli/vim/init.vim b/cli/vim/init.vim index 222673a..21da971 100644 --- a/cli/vim/init.vim +++ b/cli/vim/init.vim @@ -72,6 +72,7 @@ nnoremap l l nnoremap oo o nnoremap q q nnoremap x :!chmod +x % +nnoremap scb :set scrollbind!:set cursorbind! function! GetXCopyCmd() From 642f0d29d4c7627a4776e75be2e1cac0818f6dbf Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Fri, 19 Nov 2021 00:35:10 +0800 Subject: [PATCH 3/7] feat: loadenv support EnvVar subsitution --- cli/fish/config.fish | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cli/fish/config.fish b/cli/fish/config.fish index a55b594..f0c72e5 100644 --- a/cli/fish/config.fish +++ b/cli/fish/config.fish @@ -88,8 +88,7 @@ if status is-interactive if string match -q '#*' $line continue end - set -l kv (string split -m 1 = -- $line) - set -gx $kv + eval export $line end < $argv[1] end From 2884cef180bc29e77b43ed86e7240610c58735c2 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Fri, 19 Nov 2021 10:59:58 +0800 Subject: [PATCH 4/7] fix: loadenv cant handle var value with special char --- cli/fish/config.fish | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cli/fish/config.fish b/cli/fish/config.fish index f0c72e5..64af807 100644 --- a/cli/fish/config.fish +++ b/cli/fish/config.fish @@ -88,7 +88,8 @@ if status is-interactive if string match -q '#*' $line continue end - eval export $line + set pair (string split -m 1 '=' -- $line) + eval "set -gx $pair[1] \"$pair[2]\"" end < $argv[1] end @@ -97,5 +98,6 @@ if status is-interactive loadenv .env end end + readenv end From 02ae77996670cd5ce596dfba4c92542faa1f303d Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Mon, 20 Dec 2021 14:31:56 +0800 Subject: [PATCH 5/7] fix: vim-grepper window got replaced by coc --- cli/vim/init.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/vim/init.vim b/cli/vim/init.vim index 21da971..01a5cdd 100644 --- a/cli/vim/init.vim +++ b/cli/vim/init.vim @@ -246,9 +246,9 @@ nmap ct :CloseTagToggleBuffer " ==== grepper configuration ==== " -nnoremap sg :Grepper -tool git -nnoremap sc :Grepper -tool grep -nnoremap sa :Grepper -tool ag +nnoremap sg :Grepper -noquickfix -tool git +nnoremap sc :Grepper -noquickfix -tool grep +nnoremap sa :Grepper -noquickfix -tool ag " ==== quickfix configuration ==== nnoremap cj :cn From e7bc71f4489e55b81c473809854a64a071fe3044 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Fri, 28 Jan 2022 23:34:37 +0800 Subject: [PATCH 6/7] fix: loadenv unable to handle quote --- cli/fish/config.fish | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cli/fish/config.fish b/cli/fish/config.fish index 64af807..71a6f47 100644 --- a/cli/fish/config.fish +++ b/cli/fish/config.fish @@ -89,7 +89,11 @@ if status is-interactive continue end set pair (string split -m 1 '=' -- $line) - eval "set -gx $pair[1] \"$pair[2]\"" + if string match -q "'*" $pair[2]; or string match -q '"*' $pair[2] + eval "set -gx $pair[1] $pair[2]" + else + eval "set -gx $pair[1] \"$pair[2]\"" + end end < $argv[1] end From 62829ef9956e18e261cdef3a4acaf44eb78ddec9 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Mon, 21 Feb 2022 09:12:37 +0800 Subject: [PATCH 7/7] fix: auto-loading .env is not ideal --- cli/fish/config.fish | 17 ++++++++++------- cli/vim/coc-settings.json | 1 - 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cli/fish/config.fish b/cli/fish/config.fish index 71a6f47..7ddae7e 100644 --- a/cli/fish/config.fish +++ b/cli/fish/config.fish @@ -92,16 +92,19 @@ if status is-interactive if string match -q "'*" $pair[2]; or string match -q '"*' $pair[2] eval "set -gx $pair[1] $pair[2]" else - eval "set -gx $pair[1] \"$pair[2]\"" + if not eval "export $pair[1]=\"$pair[2]\"" + echo failed to export pair $pair + return + end end end < $argv[1] end - function readenv --on-variable PWD - if test -r .env - loadenv .env - end - end - readenv + #function readenv --on-variable PWD + #if test -r .env + #loadenv .env + #end + #end + #readenv end diff --git a/cli/vim/coc-settings.json b/cli/vim/coc-settings.json index 5b82291..b4831ac 100644 --- a/cli/vim/coc-settings.json +++ b/cli/vim/coc-settings.json @@ -8,7 +8,6 @@ }, "coc.preferences.formatOnSaveFiletypes": [ "rust", - "json", "go" ] }