Skip to content

Instantly share code, notes, and snippets.

@eloytoro
Created June 3, 2018 16:15
Show Gist options
  • Save eloytoro/2a79c4ac21c34beb4dc1d7e564bea054 to your computer and use it in GitHub Desktop.
Save eloytoro/2a79c4ac21c34beb4dc1d7e564bea054 to your computer and use it in GitHub Desktop.
" ----------------------------------------------------------------------------
" 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