Question

Consider I have a NERDTree window and more then 2 file view windows are opened in vim. In this case a common way to switch to NERDTree (navigating with several Ctrl+w g/h/j/k) is not very handy as it is not universal for all the open windows.

Is there a way to switch to NERDTree (or any other, may be) window directly?

Was it helpful?

Solution 3

Depending on your window layout, if NERDTree is near the top-left corner, it may have a fixed window number (:echo winnr() will tell you). You can then use [N]<C-w><C-w> to go to window number [N].

If your layout is more dynamic, it might make sense to include the window number in your 'statusline':

:set statusline+=\ %{winnr()}

OTHER TIPS

<C-w>t

should do what you want.

You can make a mapping to do this:

nnoremap <silent> <Leader>t :NERDTreeFocus<CR>

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top