Warm tip: This article is reproduced from serverfault.com, please click
vim

How to stop Vim from splitting window horizontally when doing an :Ex

发布于 2020-12-01 03:22:05

When I use :Ex to open a new file, Vim sometimes decides to split the window horizontally. I don't like that behavior. I prefer what Vim usually does, which is to open the file in its own... window, I guess it's called in Vim? Anyway, when it doesn't split the window horizontally. How can I control what behavior is trigger by an :Ex?

Questioner
tomcam
Viewed
0
Doktor OSwaldo 2020-12-01 19:43:29

Well :h is your friend. :h :Ex shows you the following:

:Explore will open the local-directory browser on the current file's directory (or on directory [dir] if specified). The window will be split only if the file has been modified and |'hidden'| is not set, otherwise the browsing window will take over that window. Normally the splitting is taken horizontally. Also see: |netrw-:Rexplore|

So vim will split the window, if you haven't saved your changes. This is to ensure, that you don't lose anything. I am not aware of any possibility to turn it off. You could of course redefine :Ex to just discard or save changes.