diff --git a/cli/fish.sh b/cli/fish.sh index c4138ea..0c62277 100755 --- a/cli/fish.sh +++ b/cli/fish.sh @@ -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" diff --git a/cli/fish/config.fish b/cli/fish/config.fish index cfb971b..5d3cd59 100644 --- a/cli/fish/config.fish +++ b/cli/fish/config.fish @@ -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 diff --git a/cli/fish/functions/f.fish b/cli/fish/functions/f.fish new file mode 100644 index 0000000..71fbf91 --- /dev/null +++ b/cli/fish/functions/f.fish @@ -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 diff --git a/cli/lf.sh b/cli/lf.sh new file mode 100755 index 0000000..394591d --- /dev/null +++ b/cli/lf.sh @@ -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" diff --git a/cli/lf/lfrc b/cli/lf/lfrc new file mode 100644 index 0000000..cd43a86 --- /dev/null +++ b/cli/lf/lfrc @@ -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 diff --git a/devel/go.sh b/devel/go.sh index 010b865..b6ab9c4 100755 --- a/devel/go.sh +++ b/devel/go.sh @@ -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