Add ranger function to cd on exit with Q key

main
Yax 11 months ago
parent 312e645e9e
commit eec4abcb12

@ -96,6 +96,20 @@ if test -e "$HOME/.config/fish/custom.fish"
source "$HOME/.config/fish/custom.fish" source "$HOME/.config/fish/custom.fish"
end end
# ranger: Q to cd on exit
function ranger
set tempfile (mktemp -t tmp.XXXXXX)
set command_argument "map Q chain shell echo %d > $tempfile; quitall"
command ranger --cmd="$command_argument" $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
# Commands to run in interactive sessions can go here # Commands to run in interactive sessions can go here
if status is-interactive if status is-interactive
abbr -a rm "rm --interactive --verbose" abbr -a rm "rm --interactive --verbose"

Loading…
Cancel
Save