dotfiles/cli/fish/functions/r.fish
2020-11-22 09:38:00 +08:00

14 lines
357 B
Fish

function r --description='sync ranger pwd to shell when exit'
set tempfile (mktemp -t tmp.XXXXXX)
command ranger --choosedir=$tempfile $argv
if test -s $tempfile
set ranger_pwd (cat $tempfile)
if test -n $ranger_pwd -a -d $ranger_pwd
builtin cd -- $ranger_pwd
end
end
command rm -f -- $tempfile
end