Resize splits

4.2
(90)

Tired of splits not sizing the way you like? Preview split or the quickfix list not laying out the way you’d like? Annoyed by lines just a hair too long on one size of a vertical split? Want just a few more lines in your :Git window to make sense of what you are looking at? This was a huge frustration for me in Vim. For years I frustratingly accepted it. A while back, on a whim I guessed :res 30 to see if it would resize the quickfix window. Wow, it worked? Many moons later, digging into the help for :resize yielded a number of options for manipulating window size.

As mentioned above, :res N will vertically resize the current split to N lines. But all of the following will work, too. The following mappings resize one line/column at a time. Or, if you prepend them with a number, you can resize N lines at once.

  • <Ctrl-w> - – decrease the height of the current split by one line
  • <Ctrl-w> + – increase the height of the current split by one line
  • <Ctrl-w> > – increase the width of the current split by one line
  • <Ctrl-w> < – decrease the width of the current split by one line

When all else fails, you can resize all splits to be sensibly equal in size using C-w=. This last nugget was covered in our tip Equalize your splits. Checkout the video below. In it, I demonstrate the following:

  • 5 <Ctrl-w> > – Makes left split 5 columns wider
  • 10 <Ctrl-w> < – Makes left split 10 columns narrower
  • <Ctrl-w> J – Move current split to the bottom.
  • 5 <Ctrl-w> – Make bottom split 5 rows shorter
  • 10 <Ctrl-w> + – Make bottom split 10 rows taller
  • <Ctrl-w> = – Equalize splits again

How useful was this tip?

Average rating 4.2 / 5. Vote count: 90

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

Andy Libby

36 Posts

Rider of bicycles. Writer of code. User of Vim.
View all posts