Keep cursor in Netrw window when browsing files in VIM

vim

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?

Best Answer

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.

Related Question