Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
ranger-cd for zsh
#This is based on:
#Paste this into your .zshrc:
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")"
rm -f -- "$tempfile"
bindkey -s '^O' 'ranger-cd\n'
#ranger-cd will fire for Ctrl+O
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.