From ee254689207889e68061f0680f4d6ac47d5ed408 Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 28 Sep 2011 20:15:12 +0200 Subject: improved bash wrappers in ranger.py and man page --- doc/ranger.pod | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'doc/ranger.pod') diff --git a/doc/ranger.pod b/doc/ranger.pod index f6dbdb60..b59f7a40 100644 --- a/doc/ranger.pod +++ b/doc/ranger.pod @@ -778,20 +778,22 @@ opening in your current vim session. =head2 Bash: cd to last path after exit -This is a bash function (to put in your F<~/.bashrc>) to change the directory -to the last visited one after ranger quits. You can always type C to go -back to the original one. +This is a bash function (for F<~/.bashrc>) to change the directory to the last +visited one after ranger quits. You can always type C to go back to the +original one. function ranger-cd { - tempfile=/tmp/chosendir - /usr/bin/ranger --choosedir=$tempfile "$@" - if [ -f $tempfile -a "$(cat $tempfile)" != "$(pwd | tr -d "\n")" ] - then - cd "$(cat $tempfile)" - rm $tempfile + tempfile='/tmp/chosendir' + /usr/bin/ranger --choosedir="$tempfile" "${@:-$(pwd)}" + if [ -f "$tempfile" -a "$(cat "$tempfile")" != "$(pwd | tr -d "\n")" ]; then + cd "$(cat "$tempfile")" + rm "$tempfile" fi } + # This binds Ctrl-O to ranger-cd: + bind '"\C-o":"ranger-cd\C-m"' + -- cgit 1.4.1-2-gfad0 ik/mu/refs/?h=hlt&id=d0bc0d2673c41da7b5007766a7015df99020c353'>refs log tree commit diff stats