From 69ad4ca3e49bdaac3d53e7f4929f252b17836c1d Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Thu, 4 Jun 2015 16:08:30 -0400 Subject: vimrc: Add or mapping Add a mapping to open the current file in `ranger`, the console file explorer. I already have a similar command to open the current file in Finder, but these days I find ranger a bit more pleasant to use, particularly if I'm already in the console. It's definitely more keyboard-friendly. This came about because I was trying to copy a file and the built-in Vim methods for doing so that I know of were more complicated than I wanted. 1. Use :saveas [filename] This method does the right thing in copying but the copy goes to Vim's :pwd. I wanted it to go to the same directory the file was in. 2. Use Netrw The mf mt mc commands were a little confuddling to me. It makes sense when copying a file to a directory, but how do I duplicate a file in the same directory? 3. Use :shell Opens a shell, but in Vim's :pwd, not in the current file's directory. Maybe I should make a mapping for this. --- vimrc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'vimrc') diff --git a/vimrc b/vimrc index e81bb81..7a295b5 100644 --- a/vimrc +++ b/vimrc @@ -274,6 +274,7 @@ " which functions more like NERDTree by not going to a new "page" when " changing directories. With this change I think we can uninstall " NERDTree. +" * Add or mapping to open the current file in ranger. " @@ -569,6 +570,9 @@ nnoremap om :execute '!mate "' . expand('%:p') . '"' " Open current file in Finder nnoremap of :execute '!open "' . expand('%:p:h') . '"' +" Open current file in ranger +nnoremap or :execute '!ranger "' . expand('%:p:h') . '"' + " HTML " Split outer tag on a single line to multiple lines " Example: -- cgit v1.2.3