1

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.

  • 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 May 10 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 May 11 at 6:08
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, privacy policy and cookie policy

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