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
    I think this is the default behaviour. What’s the output of the command :echo g:netrw_browse_split and verbose nmap <cr>? when run in netrw?
    – Rich
    Commented May 10, 2019 at 21:11
  • 1
    You'd like to do what while editing a file? Oh, sorry, I didn't see the colon. (I had Borat's voice in my head when I first read it.) :)
    – B Layer
    Commented May 11, 2019 at 6:08
  • If you are here because something is overriding 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.)
    – toraritte
    Commented Aug 20, 2020 at 20:39

1 Answer 1


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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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