Stop NERDTree opening when vim starts
Question
I have NERDTree plugin installed but it is always present when I start vim like this:
vim .
I only want it to open on demand.
How can I stop it opening whenever I start vim?
Solution
Try adding
let g:NERDTreeHijackNetrw=0
to your vimrc and make sure there is no other line that sets this variable.
OTHER TIPS
$ vim .
always opens a file explorer. If you don't have NERDTree or NERDTree is configured as per ZyX's answer you'll get netrw
by default anyway.
I wonder what would happen if the netrw
plugin was somehow removed.
In your vimrc file, do below steps
comment
autocmd VimEnter * NERDTree
, which stops opening nerdTree by defaultpaste
map <C-n> :NERDTreeToggle<CR>
in vimrc, this will open NerdTree only when 'Ctrl+n' is pressed from keyboard
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow