I'd like to be able to :Sex
when editing a file, select a file, press CR, and have that new split populated with the file I just selected. Is there an option for this? I think I became used to this behavior when using NERDtree or another plugin.
1 Answer
Well, I have let g:netrw_browse_split = 4
in my vimrc under the comment "These settings cause Netrw file explorer to behave more like NERDTree" yet I see the same behavior as you're seeing now. So 1) you must be thinking about that other plugin and, more importantly, 2) I'd guess you (or something) is setting that global var somewhere.
What you want is to unset it or set it explicitly to 0.
*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)
I tested with 0 and it works the way you want.
-
I was set to 4, which came from shapeshed.com/vim-netrw . Thanks! May 14, 2019 at 18:42
-
1
:echo g:netrw_browse_split
andverbose nmap <cr>?
when run in netrw?g:netrw_browse_split
(to 4), but all the commands by @Rich show that it is set to 0, and all override attempts seems futile, that's probably because:Lexplore
or something similar has been used. Not mentioned in the docs (at least, i couldn't find it) but it permanently overrides this option, and the only way I was able to set it back to default is to restart the entire thing. (Tip: use vim sessions.)