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

This commit is contained in:
Klesh Wong 2021-03-21 18:10:10 +08:00
commit c313802596
6 changed files with 216 additions and 2 deletions

View File

@ -58,6 +58,7 @@ lnsf "$DIR/fish/functions/fish_prompt.fish" "$XDG_CONFIG_HOME/fish/functions/fis
lnsf "$DIR/fish/functions/fish_right_prompt.fish" "$XDG_CONFIG_HOME/fish/functions/fish_right_prompt.fish"
lnsf "$DIR/fish/functions/fisher.fish" "$XDG_CONFIG_HOME/fish/functions/fisher.fish"
lnsf "$DIR/fish/functions/r.fish" "$XDG_CONFIG_HOME/fish/functions/r.fish"
lnsf "$DIR/fish/functions/f.fish" "$XDG_CONFIG_HOME/fish/functions/f.fish"
lnsf "$DIR/fish/functions/append_paths.fish" "$XDG_CONFIG_HOME/fish/functions/append_paths.fish"
lnsf "$DIR/fish/functions/source_files.fish" "$XDG_CONFIG_HOME/fish/functions/source_files.fish"

View File

@ -53,7 +53,7 @@ if status is-interactive
alias dt='date "+%Y%m%d-%H%M%S"'
# === PATH and file sourcing
append_paths ~/bin ~/.local/bin ~/.yarn/bin ~/dotfiles/bin ~/dotfiles/devops/bin
append_paths ~/go/bin ~/bin ~/.local/bin ~/.yarn/bin ~/dotfiles/bin ~/dotfiles/devops/bin
source_files /usr/share/autojump/autojump.fish /usr/local/share/autojump/autojump.fish \
~/.jabba/jabba.fish \
~/.profile.fish

174
cli/fish/functions/f.fish Normal file
View File

@ -0,0 +1,174 @@
function f --description='sync lf pwd to shell when exit'
set -x LF_ICONS "\
tw= :\
st= :\
ow= :\
dt= :\
di= :\
fi= :\
ln= :\
or= :\
ex= :\
*.c= :\
*.cc= :\
*.clj= :\
*.coffee= :\
*.cpp= :\
*.css= :\
*.d= :\
*.dart= :\
*.erl= :\
*.exs= :\
*.fs= :\
*.go= :\
*.h= :\
*.hh= :\
*.hpp= :\
*.hs= :\
*.html= :\
*.java= :\
*.jl= :\
*.js= :\
*.json= :\
*.lua= :\
*.md= :\
*.php= :\
*.pl= :\
*.pro= :\
*.py= :\
*.rb= :\
*.rs= :\
*.scala= :\
*.ts= :\
*.vim= :\
*.cmd= :\
*.ps1= :\
*.sh= :\
*.bash= :\
*.zsh= :\
*.fish= :\
*.tar= :\
*.tgz= :\
*.arc= :\
*.arj= :\
*.taz= :\
*.lha= :\
*.lz4= :\
*.lzh= :\
*.lzma= :\
*.tlz= :\
*.txz= :\
*.tzo= :\
*.t7z= :\
*.zip= :\
*.z= :\
*.dz= :\
*.gz= :\
*.lrz= :\
*.lz= :\
*.lzo= :\
*.xz= :\
*.zst= :\
*.tzst= :\
*.bz2= :\
*.bz= :\
*.tbz= :\
*.tbz2= :\
*.tz= :\
*.deb= :\
*.rpm= :\
*.jar= :\
*.war= :\
*.ear= :\
*.sar= :\
*.rar= :\
*.alz= :\
*.ace= :\
*.zoo= :\
*.cpio= :\
*.7z= :\
*.rz= :\
*.cab= :\
*.wim= :\
*.swm= :\
*.dwm= :\
*.esd= :\
*.jpg= :\
*.jpeg= :\
*.mjpg= :\
*.mjpeg= :\
*.gif= :\
*.bmp= :\
*.pbm= :\
*.pgm= :\
*.ppm= :\
*.tga= :\
*.xbm= :\
*.xpm= :\
*.tif= :\
*.tiff= :\
*.png= :\
*.svg= :\
*.svgz= :\
*.mng= :\
*.pcx= :\
*.mov= :\
*.mpg= :\
*.mpeg= :\
*.m2v= :\
*.mkv= :\
*.webm= :\
*.ogm= :\
*.mp4= :\
*.m4v= :\
*.mp4v= :\
*.vob= :\
*.qt= :\
*.nuv= :\
*.wmv= :\
*.asf= :\
*.rm= :\
*.rmvb= :\
*.flc= :\
*.avi= :\
*.fli= :\
*.flv= :\
*.gl= :\
*.dl= :\
*.xcf= :\
*.xwd= :\
*.yuv= :\
*.cgm= :\
*.emf= :\
*.ogv= :\
*.ogx= :\
*.aac= :\
*.au= :\
*.flac= :\
*.m4a= :\
*.mid= :\
*.midi= :\
*.mka= :\
*.mp3= :\
*.mpc= :\
*.ogg= :\
*.ra= :\
*.wav= :\
*.oga= :\
*.opus= :\
*.spx= :\
*.xspf= :\
*.pdf= :\
*.nix= :\
"
set tempfile (mktemp -t tmp.XXXXXX)
command lf -last-dir-path $tempfile $argv
if test -s $tempfile
set dir (cat $tempfile)
if test -n $dir -a -d $dir
builtin cd -- $dir
end
end
command rm -f -- $tempfile
end

16
cli/lf.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
set -e
DIR=$(dirname "$(readlink -f "$0")")
. "$DIR/../env.sh"
if ! has_cmd go; then
"$PDIR/devel/go.sh"
fi
log 'Setting up lf'
# install lf
env GOPROXY= CGO_ENABLED=0 GO111MODULE=on go get -u -ldflags="-s -w" github.com/gokcehan/lf
# linking configuration files
lnsf "$DIR/lf/lfrc" "$XDG_CONFIG_HOME/lf/lfrc"

23
cli/lf/lfrc Normal file
View File

@ -0,0 +1,23 @@
set drawbox
set icons
cmd mkdir %mkdir "$@"
cmd copyfilepath %echo "$f" | xsel -b
map Yp copyfilepath
cmd copyfilename %basename "$f" | xsel -b
map Yn copyfilename
cmd pasteoverwrite %{{
load=$(lf -remote 'load')
mode=$(echo "$load" | sed -n '1p')
list=$(echo "$load" | sed '1d')
if [ $mode = 'copy' ]; then
cp -R $list .
elif [ $mode = 'move' ]; then
mv $list .
fi
lf -remote 'send load'
lf -remote 'send clear'
}}
map P pasteoverwrite

View File

@ -18,7 +18,7 @@ esac
if in_china; then
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/
fi
# coc.nvim