diff --git a/private_dot_config/private_fish/config.fish.tmpl b/private_dot_config/private_fish/config.fish.tmpl index 39d84b8..625836a 100644 --- a/private_dot_config/private_fish/config.fish.tmpl +++ b/private_dot_config/private_fish/config.fish.tmpl @@ -96,6 +96,20 @@ if test -e "$HOME/.config/fish/custom.fish" source "$HOME/.config/fish/custom.fish" 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 if status is-interactive abbr -a rm "rm --interactive --verbose"