Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 5 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.

share|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 '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 '12 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 '12 at 3:28
    
Thanks @garyjohn, I contacted the author. Hopefully he'll have some time to look into it. –  Art Feb 15 '12 at 0:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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