ohmyzsh/plugins/ranger-cd/ranger-cd.plugin.zsh
2017-11-21 13:59:21 +01:00

13 lines
316 B
Bash

# functions
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
rm -f -- "$tempfile"
}
# aliases
alias ranger=ranger-cd