diff options
-rw-r--r-- | README | 32 | ||||
-rw-r--r-- | ranger/help/invocation.py | 14 |
2 files changed, 28 insertions, 18 deletions
diff --git a/README b/README index fc576315..c1462ec3 100644 --- a/README +++ b/README @@ -88,10 +88,13 @@ To customize ranger, copy the files from ranger/defaults/ to ~/.config/ranger/ and modify them according to your wishes. -Usage Tips ----------- +Combine Ranger With Other Applications +-------------------------------------- + +1. bash: + +Add this to your ~/.bashrc to use ranger as a directory switcher: -The author of ranger uses this function (in ~/.bashrc) to start ranger: function ranger-cd { before="$(pwd)" python2.6 /the/path/to/ranger/ranger.py --fail-unless-cd "$@" || return 0 @@ -102,10 +105,27 @@ function ranger-cd { } bind '"\C-o":"ranger-cd\C-m"' -This changes the directory after you close ranger and adds the shortcut -<CTRL-O> for starting ranger. - +Now when you run ranger-cd, browse and quit, the directory of the bash process +you started ranger in will change to the last directroy in ranger. To change back to the previous directory, you can type: cd - +Also, the line with "bind" will map the key <CTRL-O> to start ranger. + +2. vim: + +Add this function to your ~/.vimrc: + +fun Ranger() + silent !ranger --choosefile=/tmp/chosen + if filereadable('/tmp/chosen') + exec 'edit ' . system('cat /tmp/chosen') + call system('rm /tmp/chosen') + endif + redraw! +endfun +map <leader>r :call Ranger() + +This starts ranger when you type <leader>r (usually \r) and if you open a file +in ranger it will be opened in the original vim process. Troubleshooting, Getting Help diff --git a/ranger/help/invocation.py b/ranger/help/invocation.py index f71e3892..465b0de8 100644 --- a/ranger/help/invocation.py +++ b/ranger/help/invocation.py @@ -70,18 +70,6 @@ command line. as <target>. This file can be read in a script and used to open a certain file which has been chosen with ranger. - Here, for instance, is a vim script that uses ranger in vim to open files: - - fun Ranger() - silent !ranger --choosefile=/tmp/chosen - if filereadable('/tmp/chosen') - exec 'edit ' . system('cat /tmp/chosen') - call system('rm /tmp/chosen') - endif - redraw! - endfun - map <leader>r :call Ranger() - (Optional) Positional Argument The positional argument should be a path to the directory you want ranger to start in, or the file which you want to run. @@ -96,6 +84,8 @@ Examples: ranger --debug /usr/bin ranger --confdir=~/.config/ranger --fail-unless-cd +See the README on how to integrate ranger with various external programs. + ============================================================================== 5.2. Python Options |