Created
June 3, 2018 16:15
-
-
Save eloytoro/2a79c4ac21c34beb4dc1d7e564bea054 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" ---------------------------------------------------------------------------- | |
" NERDTree | |
" ---------------------------------------------------------------------------- | |
function! NERDTreeFindOrToggle() | |
let s:empty = @% == "" || filereadable(@%) == 0 || line('$') == 1 && col('$') == 1 | |
if s:empty || exists("b:fugitive_type") || exists("t:NERDTreeBufName") && bufwinnr(t:NERDTreeBufName) != -1 | |
:NERDTreeToggle | |
else | |
:NERDTreeFind | |
endif | |
endfunction | |
map <silent> <Leader>n :call NERDTreeFindOrToggle()<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment