44

I am using vim with NERDTree to develop, but not good at it. I have two questions with NERDTree:

  1. How to move cursor between nav window and edit window without mouse?
  2. How to go to one special file node (named xxx) in nav window directly by keyboard?
Matthew Rankin
  • 457,139
  • 39
  • 126
  • 163
why
  • 23,923
  • 29
  • 97
  • 142

1 Answers1

92

The NERDTree plugin creates a Vim buffer, and displays it in a Vim window. So you can use any of your normal Vim commands.

(1) Thus, if your edit window is to the right of the NERDTree window, you would use: ctrl + Wl to go to right window and ctrl + Wh to go to left window. or ctrl + w twice to toggle between the two.

(2) To go to a special file, simply search for it while in the NERDTree window:

 /xxx

Hit ENTER to end the search at the line, and then ENTER again to open the file in the previous window and go to it.

Neeraj Verma
  • 495
  • 4
  • 17
Jeet
  • 38,594
  • 7
  • 49
  • 56
  • 7
    thanks!C-W is very useful for me! but i find out that i need hit C-W twice to do that – why Dec 15 '10 at 02:24
  • 4
    For #2, it's important to note that using / inside NERDTree will only find the file if it's visible in the buffer. You may need to expand all the directories first. – ptrin Dec 15 '10 at 02:25
  • 9
    (ctrl-W twice) window, as it would in any other Vim window. l takes you to the left window, again, as it would in any other window. If you you want to hit a single key to switch windows, you will have to create a custom mapping. For example, I have bound to a custom function that cycles me through windows in order. – Jeet Dec 15 '10 at 07:40
  • 7
    You can also just do: instead of . This goes a bit faster ;) – Bulki Jan 03 '17 at 10:16