Alternative to NERDTree in Vim

Cromulent picture Cromulent · Aug 17, 2013 · Viewed 9.1k times · Source

I used to use NERDTree quite happily but found it causes problems when using the YouCompleteMe plugin (which is much more useful). In the mean time I have been using Ctrl-P which is a useful plugin in itself but I'm missing the overview of my projects that NERFTree gave me.

Can anyone suggest an alternative that does roughly the same thing and hopefully without the problems associated with NERDTree?

Answer

mhinz picture mhinz · Aug 17, 2013

If you're using a fuzzing plugin to open buffers most of the time, and use NERDTree only to explore larger directory hierarchies, you might want to learn about Vim's built-in netrw interface: :help netrw.

Options that I found particulary useful were:

let g:netrw_banner       = 0
let g:netrw_keepdir      = 0
let g:netrw_liststyle    = 1 " or 3
let g:netrw_sort_options = 'i'

And maybe a way to run it on Vim startup:

1) Open it at startup if no argument was specified ($ vim):

autocmd VimEnter * if !argc() | Explore | endif

2) Open it only when the specified argument is a directory ($ vim /tmp):

autocmd VimEnter * if isdirectory(expand('<afile>')) | Explore | endif

HTH