Merge branch 'master' of gitee.com:klesh/dotfiles

This commit is contained in:
Klesh Wong 2022-05-01 10:11:26 +08:00
commit bba37c16b4
7 changed files with 63 additions and 55 deletions

View File

@ -88,15 +88,23 @@ if status is-interactive
if string match -q '#*' $line if string match -q '#*' $line
continue continue
end end
set -l kv (string split -m 1 = -- $line) set pair (string split -m 1 '=' -- $line)
set -gx $kv if string match -q "'*" $pair[2]; or string match -q '"*' $pair[2]
eval "set -gx $pair[1] $pair[2]"
else
if not eval "export $pair[1]=\"$pair[2]\""
echo failed to export pair $pair
return
end
end
end < $argv[1] end < $argv[1]
end end
function readenv --on-variable PWD #function readenv --on-variable PWD
if test -r .env #if test -r .env
loadenv .env #loadenv .env
end #end
end #end
#readenv
end end

View File

@ -6,7 +6,7 @@ DIR=$(dirname "$(readlink -f "$0")")
log 'Setting up nnn' log 'Setting up nnn'
$NNN_CONFIG_DIR="$XDG_CONFIG_HOME/nnn/plugins" NNN_CONFIG_DIR="$XDG_CONFIG_HOME/nnn"
# setup package mirror for CHINA # setup package mirror for CHINA
case "$PM" in case "$PM" in
@ -19,13 +19,12 @@ case "$PM" in
rm -rf nnn.tar.gz rm -rf nnn.tar.gz
cd - 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/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 HTTPS_PROXY=$GITHUB_PROXY curl -Lo "$NNN_CONFIG_DIR/plugins/preview-tui" https://github.com/jarun/nnn/raw/master/plugins/preview-tui
;; ;;
pacman) pacman)
sudo pacman -S --noconfirm --needed nnn sudo pacman -S --noconfirm --needed nnn
yay -S --noconfirm --needed dragon-drag-and-drop
cp -r /usr/share/nnn/plugins/. "$NNN_CONFIG_DIR" cp -r /usr/share/nnn/plugins/. "$NNN_CONFIG_DIR"
esac esac

View File

@ -6,37 +6,35 @@ DIR=$(dirname "$(readlink -f "$0")")
log 'Setting up tmux' log 'Setting up tmux'
if ! has_cmd tmux; then case "$PM" in
case "$PM" in apt)
apt) TMUX_VER=3.2a
TMUX_VER=3.2 if ! has_cmd tmux || [ "$(tmux -V)" != "tmux $TMUX_VER" ]; then
if ! has_cmd tmux || [ "$(tmux -V)" != "tmux $TMUX_VER" ]; then sudo apt install libevent-dev libncurses5-dev bison autoconf bc -y
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
TMUX_SRC_URL=https://github.com/tmux/tmux/releases/download/$TMUX_VER/tmux-$TMUX_VER.tar.gz #if in_china; then
#if in_china; then #TMUX_SRC_URL="https://gitee.com/klesh/tmux/repository/archive/$TMUX_VER?format=tar.gz"
#TMUX_SRC_URL="https://gitee.com/klesh/tmux/repository/archive/$TMUX_VER?format=tar.gz" #fi
#fi if [ ! -f /tmp/tmux.tar.gz ]; then
if [ ! -f /tmp/tmux.tar.gz ]; then curl -L "$TMUX_SRC_URL" -o /tmp/tmux.tar.gz
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
fi fi
;; rm -rf /tmp/tmux
pacman) mkdir -p /tmp/tmux
sudo pacman -S --noconfirm --needed tmux bc tar zxvf /tmp/tmux.tar.gz -C /tmp/tmux --strip 1
;; cd /tmp/tmux
esac if [ -f autogen.sh ]; then
fi 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 # symlink configuration
lnsf "$DIR/tmux/tmux.conf" "$HOME/.tmux.conf" lnsf "$DIR/tmux/tmux.conf" "$HOME/.tmux.conf"

View File

@ -8,7 +8,6 @@
}, },
"coc.preferences.formatOnSaveFiletypes": [ "coc.preferences.formatOnSaveFiletypes": [
"rust", "rust",
"json",
"go" "go"
] ]
} }

View File

@ -72,6 +72,7 @@ nnoremap <leader>l <C-w>l
nnoremap <leader>oo <C-w>o nnoremap <leader>oo <C-w>o
nnoremap <leader>q <C-w>q nnoremap <leader>q <C-w>q
nnoremap <leader>x :!chmod +x %<Cr> nnoremap <leader>x :!chmod +x %<Cr>
nnoremap <leader>scb :set scrollbind!<Cr>:set cursorbind!<Cr>
function! GetXCopyCmd() function! GetXCopyCmd()
@ -245,9 +246,9 @@ nmap <silent> <leader>ct :CloseTagToggleBuffer<CR>
" ==== grepper configuration ==== " ==== grepper configuration ====
" "
nnoremap <leader>sg :Grepper -tool git<CR> nnoremap <leader>sg :Grepper -noquickfix -tool git<CR>
nnoremap <leader>sc :Grepper -tool grep<CR> nnoremap <leader>sc :Grepper -noquickfix -tool grep<CR>
nnoremap <leader>sa :Grepper -tool ag<CR> nnoremap <leader>sa :Grepper -noquickfix -tool ag<CR>
" ==== quickfix configuration ==== " ==== quickfix configuration ====
nnoremap <leader>cj :cn<CR> nnoremap <leader>cj :cn<CR>

View File

@ -6,6 +6,7 @@ DIR=$(dirname "$(readlink -f "$0")")
log "Setting up go" log "Setting up go"
# install go # install go
if ! has_cmd go; then
case "$PM" in case "$PM" in
pkg) pkg)
pkg install golang -y pkg install golang -y
@ -19,6 +20,7 @@ case "$PM" in
go go
;; ;;
esac esac
fi
if in_china; then if in_china; then
go env -w GO111MODULE=on go env -w GO111MODULE=on

View File

@ -42,15 +42,14 @@ EOF
# install browserpass-native # 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 if [ -n "$WSL" ]; then
echo "Please download browserpass-native for windows 64 and extract it to /usr/local/bin" 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 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 fi
# enable browser-native for google-chrome # enable browser-native for google-chrome
@ -60,11 +59,13 @@ fi
# chrome extension: https://chrome.google.com/webstore/detail/browserpass/naepdomgkenhinolocfifgehidddafch # chrome extension: https://chrome.google.com/webstore/detail/browserpass/naepdomgkenhinolocfifgehidddafch
# enable browserpass for browsers # enable browserpass for browsers
cd /usr/lib/browserpass if [ -f /usr/lib/browserpass ]; then
has_cmd chromium && make hosts-chromium-user cd /usr/lib/browserpass
has_cmd firefox && make hosts-firefox-user has_cmd chromium && make hosts-chromium-user
has_cmd google-chrome && make hosts-chrome-user has_cmd firefox && make hosts-firefox-user
cd - has_cmd google-chrome && make hosts-chrome-user
cd -
fi
# android # android
# [OpenKeyChain - encryption/decryption](https://f-droid.org/packages/org.sufficientlysecure.keychain/) # [OpenKeyChain - encryption/decryption](https://f-droid.org/packages/org.sufficientlysecure.keychain/)