12

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?

2 Answers 2

10

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.

4
  • Thanks a lot, @garyjohn! I looked through the help before asking the question, but obviously failed to find that setting.
    – Art
    Jan 12, 2012 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, 2012 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, 2012 at 3:28
  • Thanks @garyjohn, I contacted the author. Hopefully he'll have some time to look into it.
    – Art
    Feb 15, 2012 at 0:11
1

You could use :Lexplore, available with netrw v150 or later (its now up to v154, which you may get from http://www.drchip.org/astronaut/vim/index.html#NETRW).

1
  • It may not be exactly what the OP asked, but it's exactly what I was looking for! Thank you for sharing! Feb 19, 2016 at 0:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .