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 13:57:55 +00:00
|
|
|
#
|
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
|
2017-05-14 13:57:55 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
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
|