I am new to VIM. Please help me with this - or please give me a link, thank you! I found the Nerdtree very useful. i also found an article about using the command ":E", which gives a similar (or the same) look as the Nerdtree shows.
May I ask, which one to use (Nerdtree-plugin or :E)? Are there functionalities that Nerdtree shows while not :E?
Thank you and please sorry if that's really basic; i can't find a comparison if it in the web; and as a 'newbie' i do not see the difference (yet).
The :Explore
command is provided by the netrw plugin that ships with Vim. It provides a (highly configurable) file explorer, plus functionality to read / write files in remote locations. (If you just like the hierarchical tree that NERDTree defaults to, that can be configured in netrw, too: let g:netrw_liststyle = 3
)
The NERDTree plugin provides a (also highly configurable) hierarchical file tree as a sidebar, plus extension points for custom file commands. The plugin by default "grabs" the directory listing functionality from netrw (cp. :help NERDTreeHijackNetrw
), but the plugins can also coexist peacefully. NERDTree also has some secondary plugins that automatically show (and sync) the sidebar in multiple tabs etc.
If you like NERDTree, just give it a try. Also, read through the :help
of both plugins, and see which offers configuration you like / or which appeals more to you. You can always change your mind later.
While this may be a bit "off-topic" on SO, I'll say that I prefer to use Ctrl-E. Here's my script for it (that I got from somewhere else):
" Toggle Vexplore with Ctrl-E
function! ToggleVExplorer()
if exists("t:expl_buf_num")
let expl_win_num = bufwinnr(t:expl_buf_num)
if expl_win_num != -1
let cur_win_nr = winnr()
exec expl_win_num . 'wincmd w'
close
exec cur_win_nr . 'wincmd w'
unlet t:expl_buf_num
else
unlet t:expl_buf_num
endif
else
exec '1wincmd w'
Vexplore
let t:expl_buf_num = bufnr("%")
endif
endfunction
map <silent> <C-E> :call ToggleVExplorer()<CR>
" Hit enter in the file browser to open the selected
" file with :vsplit to the right of browser
"let g:netrw_brows_split = 4
"let g:netrow_altv = 1
" Default to tree mode
let g:netrw_liststyle = 3
Just throw that in your .vimrc and you should be fine.
I prefer this because it's very simple. It doesn't take up much resources and isn't computationally expensive. That's just personal preference.
Try them against each other and see what you like.
Regarding differences, I think NerdTree is more full-featured, though I'm not completely familiar with it, as I removed it a couple hours after implementing it. I just remember it taking a bit longer to respond than this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With