vimtricks.wiki Concise Vim tricks, one at a time.

How do I resize split windows using the keyboard in Vim?

Answer

<C-w>+ / <C-w>- / <C-w>> / <C-w><

Explanation

Vim provides keyboard shortcuts to resize split windows without reaching for the mouse. You can adjust both the height and width of any split incrementally or set exact dimensions.

How it works

  • <C-w>+ increases the current window height by one line
  • <C-w>- decreases the current window height by one line
  • <C-w>> increases the current window width by one column
  • <C-w>< decreases the current window width by one column
  • Prefix with a count for larger adjustments: 10<C-w>+ adds 10 lines

Example

You have a horizontal split and the bottom window is too small:

+------------------+
|   large file     |
|   (too tall)     |
+------------------+
|  small file      |
+------------------+

With cursor in the bottom window, press 10<C-w>+:

+------------------+
| large file       |
+------------------+
| small file       |
| (now taller)     |
+------------------+

Tips

  • <C-w>= equalizes all split sizes
  • <C-w>_ maximizes current window height
  • <C-w>| maximizes current window width
  • :resize 20 sets exact height to 20 lines
  • :vertical resize 80 sets exact width to 80 columns

Next

How do I visually select a double-quoted string including the quotes themselves?