change cd function names to lfcd
This commit is contained in:
1 parent
fd2d3a0f86
commit
7d47436a35
5 files changed
+59
-50
No files matched your search
@@ -0,0 +1,26 @@
|
||||
# Change working dir in fish to last dir in lf on exit (adapted from ranger).
|
||||
#
|
||||
# You may put this file to a directory in $fish_function_path variable:
|
||||
#
|
||||
# mkdir -p ~/.config/fish/functions
|
||||
# ln -s "/path/to/lfcd.fish" ~/.config/fish/functions
|
||||
#
|
||||
# You may also like to assign a key to this command:
|
||||
#
|
||||
# bind \co 'lfcd; commandline -f repaint'
|
||||
#
|
||||
# You need to put this in a function called fish_user_key_bindings.
|
||||
|
||||
function lfcd
|
||||
set tmp (mktemp)
|
||||
lf -last-dir-path=$tmp $argv
|
||||
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
|
||||
Reference in new issue
Block a user