Cannot switch NERDTree

I read that if you write nnoremap <Ce> :NERDTreeToggle<CR> , you can switch the NERDTree viewer - if you have not started NERDTree and type Control+E , then you can open the NERDTree viewer, and if you already opened it , you can close NERDTree in the same way as you type :NERDTreeToggle .

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

So how can I use the switch function? Or I'm wrong?

+4
source share
1 answer

I noticed that you are using inoremap , which only binds Ce in Insert mode.

I tried my way on my VIM installation, and indeed, it will type :NERDTreeToggle in insert mode when you press Ce. In normal mode, there is no effect.

If this is an error, try changing to:

 nnoremap <Ce> :NERDTreeToggle<CR> 

I added it to .vimrc - it works great. In addition, if you are still facing a problem, try another hotkey, you may encounter other connections.

+10
source

All Articles