From 42cf435bb9a210e267584156abb0e435cf14a6e3 Mon Sep 17 00:00:00 2001 From: hut Date: Tue, 21 Jul 2009 02:15:13 +0200 Subject: make the cd-workaround more flexible --- code/help.rb | 15 ++++++++------- ranger | 9 ++++++++- 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 -- cgit 1.4.1-2-gfad0