Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot toggle NERDTree

Tags:

vim

nerdtree

I read that if you write out nnoremap <C-e> :NERDTreeToggle<CR>, you can toggle NERDTree viewer - if you don't start NERDTree yet and type in Control+E, then you can open the NERDTree viewer, and if you already opened it, you can close the NERDTree in the same way as you type in :NERDTreeToggle.

However, when I try to do the same, I can successfully open it - but I cannot close it and the screen remains the same except the main title slightly changes, such as from NERD_tree_1 to NERD_tree_2.

So how can I use the toggle functionality? Or do I get it wrong?

like image 269
Blaszard Avatar asked Sep 20 '13 07:09

Blaszard


1 Answers

I have noticed you are using inoremap which binds a C-e in Insert Mode only.

I have tried your way on my VIM installation, and indeed it will type :NERDTreeToggle in insert mode on pressing C-e. While in normal mode there is no effect.

If it is a mistake, try changing to:

nnoremap <C-e> :NERDTreeToggle<CR>

I added it in .vimrc - it works fine. Also, if you still run into a problem, give another hotkey a try, you might be clashing with other binds.

like image 75
alandarev Avatar answered Oct 19 '22 17:10

alandarev