How do I make Vim open new splits below and to the right instead of above and left?
Answer
:set splitbelow splitright
Explanation
How it works
By default, Vim opens horizontal splits (:split or :sp) above the current window and vertical splits (:vsplit or :vsp) to the left. This can feel counterintuitive because most editors and terminals open new panes below and to the right.
Two options fix this:
:set splitbelow- New horizontal splits open below the current window:set splitright- New vertical splits open to the right of the current window
These options affect all split commands:
:split/:sp- Now opens below:vsplit/:vsp- Now opens to the right:new- New empty buffer opens below:vnew- New empty buffer opens to the rightCtrl-W s- Horizontal split opens belowCtrl-W v- Vertical split opens to the right
You can temporarily override these settings for a single command by using the modifier commands:
:topleft split- Force split above regardless of setting:botright split- Force split below:leftabove vsplit- Force split to the left:rightbelow vsplit- Force split to the right
Example
Add to your ~/.vimrc:
set splitbelow
set splitright
Before this change, running :vsplit file.txt with a file open would create:
| file.txt | current |
After setting splitright:
| current | file.txt |
The new split appears on the right, which feels more natural. Similarly, :split puts the new window below instead of above. This small change significantly improves the split workflow and matches the behavior of most modern IDEs.