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
continue
end
set -l kv (string split -m 1 = -- $line)
set -gx $kv
set pair (string split -m 1 '=' -- $line)
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
function readenv --on-variable PWD
if test -r .env
loadenv .env
end
end
#function readenv --on-variable PWD
#if test -r .env
#loadenv .env
#end
#end
#readenv
end

View File

@ -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

View File

@ -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"

View File

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

View File

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

View File

@ -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

View File

@ -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/)