Search code examples
pythonvimnerdtreepython-modenetrw

VIM + netrw: open multiple files/buffers in the same window


I have recently switched to VIM using NERDTree and python-mode. As NERDTree seems to have a conflict with python-mode and breaks my layout if I close one out of multiple buffers, I decided to switch to netrw since it is shipped with VIM anyway.

But having a file opened, if I open netrw by typing :E and open another file by hitting <enter> VIM closes the old one and opens the new one in the same window. And if I hit <o> in the same situation VIM adds another buffer but adds a new window in a horizontal split.

How can I add multiple files/buffers to the buffer list and only show the last added buffer in the active window (without new splits) using netrw? #edited#

Thanks in advance! I hope I haven't missed something trivial from the manual.. ;-)


Solution

  • But having a file opened, if I open netrw by typing :E and open another file by hitting <enter> VIM closes the old one and opens the new one in the same window.

    [...]

    How can I open multiple files/buffers in the same window using netrw?

    Buffers are added to a list, the buffer list, and facultatively displayed in one or more window in one or more tab pages.

    Since a window can only display one buffer, the only way to see two separate buffers at the same time is to display them in two separate windows. That's what netrw's o and v allow you to do.

    When you use <CR>to edit a file, the previous buffer doesn't go away: it is still in the buffer list and can be accessed with :bp[revious].