Resize splits

4.1
(83)

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.1 / 5. Vote count: 83

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

30 Posts

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

1 thought on “Resize splits”

  1. interesting! seems like + all capitalized movement keys work. e.g.

    * H : move split to be the left-most split
    * J : move split to the bottom
    * K : move split to the top
    * J : move split to be the right-most split

Leave a reply

Your email address will not be published. Required fields are marked *