2

What happens now: When I'm in Vim, and execute the :Vexplore command, a new pane appears where can I browse files using netrw. When I open a file in the netrw pane, it opens in the right pane (so not in the netrw pane) like I configured it using let g:netrw_browse_split = 4.

What I would like to happen: However, I would like the netrw pane to close immediately after the new file is opened in the right pane. Is that possible?

This comment on Reddit mentions the use of an autocommand, but I'm not familiar enough with vim scripts in order to create that unfortunately.

mattb
  • 2,787
  • 2
  • 6
  • 20
Max
  • 67
  • 6

1 Answers1

1

Seems to me that opening a file in a new buffer and closing the netrw pane is actually the same as opening a file in a netrw pane. And this is by default.

So make sure you have

let g:netrw_browse_split = 0

in your .vimrc and open netrw using :Ex, which will open netrw in current pane.

Draco Ater
  • 20,820
  • 8
  • 62
  • 86
  • Thanks. This would be a valid answer if netrw were to open in the left pane like it's the case with NERDTree, which isn't the case here. In this case, the netrw pane takes the whole pane space. – Max Jul 10 '21 at 18:48