summary refs log tree commit diff stats
path: root/doc
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2011-09-28 20:15:12 +0200
committerhut <hut@lavabit.com>2011-09-28 20:15:12 +0200
commitee254689207889e68061f0680f4d6ac47d5ed408 (patch)
tree48b0b4eeb0cbec915339e0c2b65ca3c9ed307c9f /doc
parent496c00d4200ff25c833bbaf03ee04a6031d83b92 (diff)
downloadranger-ee254689207889e68061f0680f4d6ac47d5ed408.tar.gz
improved bash wrappers in ranger.py and man page
Diffstat (limited to 'doc')
-rw-r--r--doc/ranger.124
-rw-r--r--doc/ranger.pod20
2 files changed, 24 insertions, 20 deletions
diff --git a/doc/ranger.1 b/doc/ranger.1
index 6cc2b5e4..981aa115 100644
--- a/doc/ranger.1
+++ b/doc/ranger.1
@@ -124,7 +124,7 @@
 .\" ========================================================================
 .\"
 .IX Title "RANGER 1"
-.TH RANGER 1 "ranger-1.4.3" "09/25/2011" "ranger manual"
+.TH RANGER 1 "ranger-1.4.3" "09/28/2011" "ranger manual"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
@@ -707,20 +707,22 @@ opening in your current vim session.
 .Ve
 .SS "Bash: cd to last path after exit"
 .IX Subsection "Bash: cd to last path after exit"
-This is a bash function (to put in your \fI~/.bashrc\fR) to change the directory
-to the last visited one after ranger quits.  You can always type \f(CW\*(C`cd \-\*(C'\fR to go
-back to the original one.
+This is a bash function (for \fI~/.bashrc\fR) to change the directory to the last
+visited one after ranger quits.  You can always type \f(CW\*(C`cd \-\*(C'\fR to go back to the
+original one.
 .PP
-.Vb 9
+.Vb 8
 \& function ranger\-cd {
-\&   tempfile=/tmp/chosendir
-\&   /usr/bin/ranger \-\-choosedir=$tempfile "$@"
-\&   if [ \-f $tempfile \-a "$(cat $tempfile)" != "$(pwd | tr \-d "\en")" ]
-\&   then
-\&     cd "$(cat $tempfile)"
-\&     rm $tempfile
+\&   tempfile=\*(Aq/tmp/chosendir\*(Aq
+\&   /usr/bin/ranger \-\-choosedir="$tempfile" "${@:\-$(pwd)}"
+\&   if [ \-f "$tempfile" \-a "$(cat "$tempfile")" != "$(pwd | tr \-d "\en")" ]; then
+\&     cd "$(cat "$tempfile")"
+\&     rm "$tempfile"
 \&   fi
 \& }
+\&
+\& # This binds Ctrl\-O to ranger\-cd:
+\& bind \*(Aq"\eC\-o":"ranger\-cd\eC\-m"\*(Aq
 .Ve
 .SH "LICENSE"
 .IX Header "LICENSE"
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<cd -> 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<cd -> 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"'
+