Opens nerdtree to the root of your current project if not looking at a file

This commit is contained in:
Yan Pritzker
2016-04-28 15:22:53 -05:00
parent 87e0b47f58
commit 1edab81c26

View File

@@ -75,7 +75,15 @@ imap <C-a> <esc>wa
" ==== NERD tree
" Open the project tree and expose current file in the nerdtree with Ctrl-\
nnoremap <silent> <C-\> :NERDTreeFind<CR>:vertical<CR>
" " calls NERDTreeFind iff NERDTree is active, current window contains a modifiable file, and we're not in vimdiff
function! OpenNerdTree()
if &modifiable && strlen(expand('%')) > 0 && !&diff
NERDTreeFind
else
NERDTreeToggle
endif
endfunction
nnoremap <silent> <C-\> :call OpenNerdTree()<CR>
" ,q to toggle quickfix window (where you have stuff like Ag)
" ,oq to open it back up (rare)