How to Vim: Take Control of Split Positioning
One of my pet peeves with Vim is that by default the buffer splitting behaves a bit weird:
- horizontal splits (:split) appear on top
- vertical splits (:vsplit) appear on the left
That’s exactly the opposite of how things happen by default in Emacs (and a few other editors),
so it really didn’t sit well with me. Obviously you can use dedicated commands
to control the split behavior (e.g. :rightbelow split and :botright vsplit1), but if you want to permanently
“improve” the defaults just add the following your .vimrc:
set splitbelow splitright
In case it’s not clear:
- splitbelowalters the behavior of- :split(and commands like- :helpthat use- :splitinternally)
- splitrightalters the behavior of- :vsplit
And that’s it! Now I find using commands like :h a lot more enjoyable, as the help splits
appear exactly where I expect them to.
