Improve ranger

inky
Elnu 2 years ago
parent 3bcda58024
commit 1513c012d7

@ -90,9 +90,28 @@ in
goops = "g reset --soft HEAD^";
v = "vim";
r = "ranger";
rm = "trash-put";
};
# Change to directory when exiting ranger with Q
# https://github.com/ranger/ranger/issues/1554#issuecomment-491650123
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
while true; do
f=`fortune`

Loading…
Cancel
Save