Open splits more naturally

4.8
(69)

I recently decided to blow away my Vim configuration and start from scratch. It’s been refreshing to rebuild with a new set of settings and plugins that serve my needs of today. So far I’ve unloaded a lot of heft that I wasn’t really using.

Two settings that I added back almost immediately though are those that open horizontal and vertical splits in what I consider a more natural direction: to the right and to the bottom. Here’s what I added to my .vimrc:

" change the direction of new splits
set splitbelow
set splitright

By default, when you open a horizontal split with :split or a vertical split with :vsplit, Vim will open that split above and to the left, respectively.

But if you’re like me, you read left to right and top to bottom. You might find that moving your head to the right to view the new vertical split content, or below to view the new horizontal split, is a more natural movement.

With these settings enabled, a new vertical split will open to the right. A new horizontal split will open below. This feels more natural to me so I keep this setting as a permanent fixture of my config. Or you may prefer the default direction. I’d love to hear from you in the comments which way you prefer.

How useful was this tip?

Average rating 4.8 / 5. Vote count: 69

No votes so far! Be the first to rate this tip.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Written by

Colin Bartlett

105 Posts

Vim enthusiast and software developer for more than 20 years.
View all posts