I have a vertical split in VIM. On one side I open netrw (:E) to browse through some files/folders.

Although as soon as I press 'Return' to enter a folder, folder opens and cursor is moved into other window.

How can I keep the cursor in the netrw window?

link|improve this question

feedback

1 Answer

up vote 1 down vote accepted

Put this in your .vimrc,

let g:netrw_preview = 1

to configure vertical preview splits, then when the cursor is over the desired file, type p to open a preview window. To close the window, type Ctrl-W z.

The term used in vim for a window that's opened without the cursor moving to it is a "preview window". To find out more about this, see

:help netrw-preview
:help CTRL-W_z

or just

:help netrw

and browse the table of contents for other browsing commands and other netrw features.

link|improve this answer
Thanks a lot, @garyjohn! I looked through the help before asking the question, but obviously failed to find that setting. – Art Jan 12 at 5:20
Interesting, it works most of the time, but sometimes cursor still jumps back. Happens when I open 3 vertical splits and do :E in the right one - cursor jumps to the leftmost. – Art Feb 3 at 0:31
That could be a bug. You can find the name and address of the author at the top of any of the netrw files and at ":help pi-netrw.txt". He is very helpful and responsive. I would send a description of the problem directly to him. – garyjohn Feb 3 at 3:28
Thanks @garyjohn, I contacted the author. Hopefully he'll have some time to look into it. – Art Feb 15 at 0:11
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.