dotfiles/cli/fish/functions/f.fish
2021-03-02 10:52:31 +08:00

13 lines
323 B
Fish

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