Skip to content

Instantly share code, notes, and snippets.

@andykais
Last active August 29, 2015 14:19
Show Gist options
  • Save andykais/ae652ef34b164a5912fd to your computer and use it in GitHub Desktop.
Save andykais/ae652ef34b164a5912fd to your computer and use it in GitHub Desktop.
after ranger quits, cd to the chosen directory.
ranger() {
tempfile='/tmp/chosendir'
/usr/bin/ranger --choosedir="$tempfile" "${@:-$(pwd)}"
test -f "$tempfile" &&
if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then
cd -- "$(cat "$tempfile")"
fi
rm -f -- "$tempfile"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment