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

How do I maximize a window to full height or make all windows equal size?

Answer

<C-w>_ and <C-w>=

Explanation

When working with multiple splits, you often want to focus on one window by making it as large as possible, then restore equal sizing when you're done. <C-w>_ maximizes the current window's height, and <C-w>= resets all windows to equal dimensions.

How it works

  • <C-w>_ — maximize the current window's height (takes up all available vertical space, other windows shrink to 1 line)
  • <C-w>= — equalize the height and width of all windows
  • <C-w>| — maximize the current window's width (for vertical splits)

You can also use a count: 10<C-w>_ sets the current window to exactly 10 lines tall.

Example

You have three horizontal splits open. You want to focus on the middle one:

<C-w>_       " middle window expands, top and bottom shrink to 1 line each

When done reviewing, restore all windows:

<C-w>=       " all three windows return to roughly equal height

Tips

  • Combine <C-w>_ and <C-w>| to maximize both dimensions at once
  • <C-w>o (:only) closes all other windows if you want truly full-screen — but this is destructive
  • Use :resize +5 or :resize -5 for fine-grained height adjustments
  • Map <leader>z to <C-w>_<C-w>| for a quick "zoom" toggle in your vimrc

Next

How do I return to normal mode from absolutely any mode in Vim?