From 01c321b1d2b5e8bccfabbf524117554763b4c968 Mon Sep 17 00:00:00 2001 From: hut Date: Tue, 15 Feb 2011 00:40:10 +0000 Subject: Moved vimscript to README next to the bash script :) --- README | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'README') 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 - 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 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 r :call Ranger() + +This starts ranger when you type r (usually \r) and if you open a file +in ranger it will be opened in the original vim process. Troubleshooting, Getting Help -- cgit 1.4.1-2-gfad0