about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-07-21 02:15:13 +0200
committerhut <hut@lavabit.com>2009-07-21 02:15:13 +0200
commit42cf435bb9a210e267584156abb0e435cf14a6e3 (patch)
treefffb81657b785e523b1b39006ee6cbfcd4f82b5c
parent64dc224faa89bfee11e406a013d3ca77c6f756e8 (diff)
downloadranger-42cf435bb9a210e267584156abb0e435cf14a6e3.tar.gz
make the cd-workaround more flexible
-rw-r--r--code/help.rb15
-rwxr-xr-xranger9
2 files changed, 16 insertions, 8 deletions
diff --git a/code/help.rb b/code/help.rb
index 11e3f0ae..bd6568c4 100644
--- a/code/help.rb
+++ b/code/help.rb
@@ -246,16 +246,17 @@ module Fm
 	left with ranger.
 
 	To use this feature, you have to start ranger with:
-	. /path/to/ranger
+	source /path/to/ranger /path/to/ranger
 	
-	The dot and space at the start is important!
+	If you have ranger in your /usr/bin/, you can write:
+	source ranger ranger
 
-	of course you can create an alias in our ~/.bashrc
-	alias fm='. /path/to/ranger'
+	Of course you can create an alias in our ~/.bashrc
+	alias ranger='source ranger ranger'
+
+	It's 2x ranger in "source ranger ranger" because shells are silly
+	and there was no other way to do it.
 
-	I use fm (which means filemanager) because it's quick to type
-	and because fm was the working title of ranger in the early days.
-	
 
 	If you're inside ranger and decide to stay in the original directory
 	after all, you can type tc or quit with ZX
diff --git a/ranger b/ranger
index dbe73903..6c961c92 100755
--- a/ranger
+++ b/ranger
@@ -5,7 +5,9 @@
 
 if false; then
 =begin
-fi; cd "`ranger --cd $@ 3>&1 1>&2`"; return
+fi
+cd "`$1 --workaround $@ 3>&1 1>&2`"
+return
 =end
 end
 
@@ -20,6 +22,11 @@ $: << MYDIR = File.dirname(Pathname(__FILE__).realpath)
 ##--------------------------------------------------
 # parse arguments
 
+if ARGV[1] == '--workaround'
+	ARGV.shift(2)
+	ARGV.unshift('--cd')
+end
+
 ARGV.delete('--cd') if cd = ARGV.include?('--cd')
 if ARGV.size > 0
 	case ARGV.first