diff options
Diffstat (limited to 'fish')
-rw-r--r-- | fish/.config/fish/completions/lf.fish | 11 | ||||
-rw-r--r-- | fish/.config/fish/functions/fish_user_key_bindings.fish | 3 | ||||
-rw-r--r-- | fish/.config/fish/functions/is_git.fish | 3 | ||||
-rw-r--r-- | fish/.config/fish/functions/lfcd.fish | 27 |
4 files changed, 41 insertions, 3 deletions
diff --git a/fish/.config/fish/completions/lf.fish b/fish/.config/fish/completions/lf.fish new file mode 100644 index 0000000..9fb6ba9 --- /dev/null +++ b/fish/.config/fish/completions/lf.fish @@ -0,0 +1,11 @@ +complete -c lf -o command -r -d 'command to execute on client initialization' +complete -c lf -o cpuprofile -r -d 'path to the file to write the CPU profile' +complete -c lf -o doc -d 'show documentation' +complete -c lf -o last-dir-path -r -d 'path to the file to write the last dir on exit (to use for cd)' +complete -c lf -o memprofile -r -d 'path to the file to write the memory profile' +complete -c lf -o remote -x -d 'send remote command to server' +complete -c lf -o selection-path -r -d 'path to the file to write selected files on open (to use as open file dialog)' +complete -c lf -o server -d 'start server (automatic)' +complete -c lf -o version -d 'show version' +complete -c lf -o help -d 'show help' + diff --git a/fish/.config/fish/functions/fish_user_key_bindings.fish b/fish/.config/fish/functions/fish_user_key_bindings.fish index 350a9da..73037da 100644 --- a/fish/.config/fish/functions/fish_user_key_bindings.fish +++ b/fish/.config/fish/functions/fish_user_key_bindings.fish @@ -1,3 +1,4 @@ function fish_user_key_bindings - fzf_key_bindings + fzf_key_bindings + bind \co 'lfcd; commandline -f repaint' end diff --git a/fish/.config/fish/functions/is_git.fish b/fish/.config/fish/functions/is_git.fish index a0f3091..a8370f4 100644 --- a/fish/.config/fish/functions/is_git.fish +++ b/fish/.config/fish/functions/is_git.fish @@ -1,5 +1,4 @@ function is_git - git rev-parse --verify HEAD >/dev/null ^&1 - # keeping ^ for now for v2 backwards compatibility + git rev-parse --verify HEAD >/dev/null 2>&1 end diff --git a/fish/.config/fish/functions/lfcd.fish b/fish/.config/fish/functions/lfcd.fish new file mode 100644 index 0000000..4e8e041 --- /dev/null +++ b/fish/.config/fish/functions/lfcd.fish @@ -0,0 +1,27 @@ +function lfcd + set tmp (mktemp) + set fid (mktemp) + + lf -command '$printf $id > "'$fid'"' -last-dir-path=$tmp $argv + + set id (cat $fid) + set archivemount_dir "/tmp/__lf_archivemount_"$id + + if test -f "$archivemount_dir" + for line in (cat $archivemount_dir) + umount "$line" + rm -rf "$line" + end + end + + if test -f "$tmp" + set dir (cat $tmp) + rm -f "$tmp" + if test -d "$dir" + if test "$dir" != (pwd) + cd "$dir" + end + end + end +end + |