diff options
author | Teddy Wing | 2015-06-04 16:08:30 -0400 |
---|---|---|
committer | Teddy Wing | 2015-06-04 16:08:30 -0400 |
commit | 69ad4ca3e49bdaac3d53e7f4929f252b17836c1d (patch) | |
tree | f2493fa063b6d30261ca58ce715d20a33c878c7d | |
parent | 9ec85f7fa5e118c0630e6b6457b71e80e57fa5dd (diff) | |
download | dotvim-69ad4ca3e49bdaac3d53e7f4929f252b17836c1d.tar.bz2 |
vimrc: Add <leader>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.
-rw-r--r-- | vimrc | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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 <leader>or mapping to open the current file in ranger. " @@ -569,6 +570,9 @@ nnoremap <leader>om :execute '!mate "' . expand('%:p') . '"'<cr> " Open current file in Finder nnoremap <leader>of :execute '!open "' . expand('%:p:h') . '"'<cr> +" Open current file in ranger +nnoremap <leader>or :execute '!ranger "' . expand('%:p:h') . '"'<cr> + " HTML " Split outer tag on a single line to multiple lines " Example: |