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 +5or:resize -5for fine-grained height adjustments - Map
<leader>zto<C-w>_<C-w>|for a quick "zoom" toggle in your vimrc