When I execute :Vex
or something similar the netrw buffer open which is perfectly fine. However I want to open a file, chosen from netrw, in the netrw buffer that I opened with the :Vex
command. Is this possible?
Asked
Active
Viewed 1,142 times
2

Jason Aller
- 3,541
- 28
- 38
- 38

Tom Stock
- 1,098
- 1
- 12
- 26
-
1Unless I misunderstand, you just need to press Enter on the file name, in the netrw buffer, and it will be opened inside that same window; [`:help netrw-enter`](https://vimhelp.appspot.com/pi_netrw.txt.html#netrw-enter). – Ingo Karkat Nov 15 '19 at 10:51
-
When I press enter, it opens in a vertical buffer next to the netrw buffer, so that doesn't seem to work. – Tom Stock Nov 15 '19 at 10:53
-
3That's not the default netrw behavior; have you reconfigured it? From that link above: _The |g:netrw_browse_split| option, which is zero by default, may be used to cause the opening of files to be done in a new window or tab instead of the default._ – Ingo Karkat Nov 15 '19 at 10:56
1 Answers
2
As suggested in the comments, check the current value of g:netrw_browse_split
using
:let g:netrw_browse_split
Then compare with the desired values from the docs (:h g:netrw_browse_split
):
*g:netrw_browse_split* when browsing, <cr> will open the file by:
=0: re-using the same window (default)
=1: horizontally splitting the window first
=2: vertically splitting the window first
=3: open file in new tab
=4: act like "P" (ie. open previous window)
Note that |g:netrw_preview| may be used
to get vertical splitting instead of
horizontal splitting.
=[servername,tab-number,window-number]
Given a |List| such as this, a remote server
named by the "servername" will be used for
editing. It will also use the specified tab
and window numbers to perform editing
(see |clientserver|, |netrw-ctrl-r|)
This option does not affect the production of
|:Lexplore| windows.

German Lashevich
- 2,193
- 27
- 38