Last active
June 8, 2020 13:31
-
-
Save alesandar/9fbd1f387cf2224ec0edf2c6298feb1a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ranger-cd { | |
tempfile="$(mktemp -t tmp.XXXXXX)" | |
/usr/bin/ranger --choosedir="$tempfile" "${@:-$(pwd)}" | |
test -f "$tempfile" && | |
if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then | |
cd -- "$(cat "$tempfile")" | |
fi | |
/usr/bin/rm -f -- "$tempfile" | |
} | |
run_ranger() { BUFFER="ranger"; zle accept-line; } | |
zle -N run_ranger | |
bindkey '^\er' run_ranger |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment