[feature] add lf

This commit is contained in:
Klesh Wong 2021-03-02 10:52:31 +08:00
parent 2e873564c6
commit 27d3a43452
5 changed files with 38 additions and 1 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/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/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/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/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" lnsf "$DIR/fish/functions/source_files.fish" "$XDG_CONFIG_HOME/fish/functions/source_files.fish"

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

@ -0,0 +1,12 @@
function f --description='sync lf pwd to shell when exit'
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"

8
cli/lf/lfrc Normal file
View File

@ -0,0 +1,8 @@
set drawbox
cmd mkdir %mkdir "$@"
cmd copyfilepath %echo "$f" | xsel -b
cmd copyfilename %basename "$f" | xsel -b
map Yp copyfilepath
map Yn copyfilename

View File

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