lf/etc/lf.fish

23 lines
624 B
Fish
Raw Normal View History

2017-05-14 15:21:03 +00:00
# Change working dir in fish to last dir in lf on exit (adapted from ranger).
#
2017-05-14 14:11:38 +00:00
# You need to either copy the content of this file to ~/.config/fish/config.fish
2017-05-14 15:21:03 +00:00
# or put the file to ~/.config/fish/functions using something like:
2017-05-14 14:11:38 +00:00
#
2017-05-14 15:21:03 +00:00
# mkdir -p ~/.config/fish/functions
# ln -s "$GOPATH/src/github.com/gokcehan/lf/etc/lf.fish" ~/.config/fish/functions
#
function lf
set tmp (mktemp)
command lf -last-dir-path=$tmp $argv
if test -f "$tmp"
set dir (cat $tmp)
if test -n "$dir"
if test "$dir" != (pwd)
cd $dir
end
end
end
rm -f $tmp
end