mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-29 04:53:17 +02:00
ranger-cd plugin added
This commit is contained in:
parent
e273cf004e
commit
488c80bfd4
2 changed files with 22 additions and 0 deletions
13
plugins/ranger-cd/ranger-cd.plugin.zsh
Normal file
13
plugins/ranger-cd/ranger-cd.plugin.zsh
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue