Improve ranger

inky
Elnu 2 years ago
parent 3bcda58024
commit 1513c012d7

@ -90,9 +90,28 @@ in
goops = "g reset --soft HEAD^"; goops = "g reset --soft HEAD^";
v = "vim"; v = "vim";
r = "ranger";
rm = "trash-put"; rm = "trash-put";
}; };
# Change to directory when exiting ranger with Q
# https://github.com/ranger/ranger/issues/1554#issuecomment-491650123
bashrcExtra = '' bashrcExtra = ''
function ranger {
local IFS=$'\t\n'
local tempfile="$(mktemp -t tmp.XXXXXX)"
local ranger_cmd=(
command
ranger
--cmd="map Q chain shell echo %d > "$tempfile"; quitall"
)
''${ranger_cmd[@]} "$@"
if [[ -f "$tempfile" ]] && [[ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]]; then
cd -- "$(cat "$tempfile")" || return
fi
command rm -f -- "$tempfile" 2>/dev/null
}
pfetch pfetch
while true; do while true; do
f=`fortune` f=`fortune`

Loading…
Cancel
Save