Search code examples
vimnerdtree

How can I switch in and out of NERDtree?


Is there a way to switch in and out of NERDtree -- mouse disabled? I know I can press 'q' to quit NERDtree and go back to text editor, but when I go back to NERDtree it doesn't keep track of which directories I had pressed open before, and I would like to keep the list of directories open. I referenced NERDtree help, but I couldn't find what I was looking for. Perhaps I missed something?

Thanks in advance.


Solution

  • NERDTree opens as a sidebar next to the existing open windows. You can therefore use all Vim window movement commands to jump back and forth.

    For example, <C-W>p (that's Ctrl + W followed by P) goes back to the previous window, and 1<C-W><C-W> goes to the first window (which usually is the leftmost split NERDTree). You'll find the whole list at :help window-move-cursor; for effective window handling, it's important you know these very well.