mirror of
https://gitea.zaclys.com/yannic/dotfiles.git
synced 2026-06-15 11:11:57 +02:00
Add ranger function to cd on exit with Q key
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user