Step 7 of 9

12. Windows

Resizing windows

You can resize windows to fit your preferences. First: the <C-w> bindings for creating windows accept counts — 80<C-w>s opens a horizontal split 80 lines tall, and 80<C-w>v a vertical split 80 columns wide.

To resize windows after creating them:

  • [count]<C-w>+ / [count]<C-w>- — grow/shrink the height by [count] rows.
  • [count]<C-w>> / [count]<C-w>< — grow/shrink the width by [count] columns.
  • [count]<C-w>_ / [count]<C-w>| — set the height/width to exactly [count]; with no count, maximize it.
  • <C-w>=write this one down! — resize all windows back to sensible defaults.

(In your local Vim, :set mouse+=a also lets you drag window borders — the embedded editor doesn’t support that yet, sorry!)

Work through the checklist — the W map stands in for <C-w> again.

  1. Map W to stand in for <C-w> Type :nnoremap W <C-w> and hit Enter.
  2. Open a split exactly 10 lines tall Counts work on window commands — type 10Ws (real Vim, 10<C-w>s).
  3. Grow it by 5 lines To make the current window 5 rows taller (real Vim, 5<C-w>+), type 5W+.
  4. Maximize its height Without a count, the height stretches as far as it can (real Vim, <C-w>_) — type W_.
  5. Reset every window to a sensible size Type W= (real Vim, <C-w>=) — this is the one to write down!
Map W to stand in for <C-w> Type :nnoremap W <C-w> and hit Enter.

Next: Open a split exactly 10 lines tall

Loading editor…