commit 8b0bc81a3378ced31ae87d0ab6417badbcc70384 (patch)
parent 8786477ea1ab1e9feb443fdc84c3c5c6067f16b2
Author: Alexander Karle <akarle@umass.edu>
Date: Sun, 9 Dec 2018 11:45:52 -0500
vim: Improve 'open directory' mapping
If we have dirvish, use the :Dirvish command, else :Explore
Using the old :e %:p:h misses out on :Dirvishes' behavior of jumping to
the file that is currently being edited, which is nice to have
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/vim/vimrc b/vim/vimrc
@@ -240,7 +240,11 @@ nnoremap <leader>D :set background=dark<CR>
nnoremap <expr> <leader>C ToggleColorColumn()
" Quick open current directory of file being edited
-nnoremap <leader>d :e %:p:h/<CR>
+if isdirectory(s:vimdir . '/bundle/vim-dirvish')
+ nnoremap <leader>d :Dirvish %:p:h<CR>
+else
+ nnoremap <leader>d :Explore<CR>
+endif
" easier tab switching (good for use w terminal wher gt doesn't work)
nnoremap <C-w>t :tabnext<CR>