Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to jump back to NERDTree from file in tab?

Tags:

vim

ide

nerdtree

People also ask

How do you switch between tabs in NERDTree and file?

Ctrl + → arrow will switch to tab that is on the right of current tab.

How do I switch to NERDTree?

Toggle the NERDtree window open and closed with <SHIFT>F8 key. Or use the \nt key mapping to open the file explorer with the cursor focus set to the file in your current vim buffer. So you probably just learned the most important part of this post. Open NERDtree with <SHIFT>F8 or :NERDTree command.


Ctrl-ww

This will move between open windows (so you could hop between the NERDTree window, the file you are editing and the help window, for example... just hold down Ctrl and press w twice).


Ctrl+ww cycle though all windows

Ctrl+wh takes you left a window

Ctrl+wj takes you down a window

Ctrl+wk takes you up a window

Ctrl+wl takes you right a window


NERDTree opens up in another window. That split view you're seeing? They're called windows in vim parlance. All the window commands start with CTRL-W. To move from adjacent windows that are left and right of one another, you can change focus to the window to the left of your current window with CTRL-w h, and move focus to the right with CTRL-w l. Likewise, CTRL-w j and CTRL-w k will move you between horizontally split windows (i.e., one window is above the other). There's a lot more you can do with windows as described here.

You can also use the :NERDTreeToggle command to make your tree open and close. I usually bind that do t.


If you use T instead of t there is no need to jump back because the new tab will be opened, but vim's focus will simply remain within NERDTree.


You can focus on a split window using # ctrl-ww.

for example, pressing:

1 ctrl-ww

would focus on the first window, usually being NERDTree.


ctrl-ww Could be useful when you have limited tabs open. But could get annoying when you have too many tabs open.

I type in :NERDTree again to get the focus back on NERDTree tab instantly wherever my cursor's focus is. Hope that helps