Creating Splits

Ctrl-W s โ€” horizontal split. Ctrl-W v โ€” vertical.

Keys: Ctrl-W s, Ctrl-W v, :sp, :vs

Ctrl-W s splits the current window horizontally; Ctrl-W v splits vertically. :sp and :vs do the same and can take a filename to open in the new split.

A window is a viewport. Splits give you more than one. Ctrl-W s stacks two viewports vertically (a horizontal split). Ctrl-W v puts them side by side (a vertical split).

Horizontal split (top/bottom)
KeyNote
Ctrl-W
s
Vertical split (left/right)
KeyNote
Ctrl-W
v
Horizontal split, open {file}
KeyNote
:
s
p
{file}
Enter
Vertical split, open {file}
KeyNote
:
v
s
{file}
Enter
Ctrl-W s โ€” horizontal split
Ctrl-W v โ€” vertical split

Worked example โ€” :split and :vsplit

Two views of one buffer (or two).

Step 1 ยท
windows.splits
Step 2 ยท :sp ยท :sp โ€” horizontal split.
:sp โ€” horizontal split.
Step 3 ยท :vsp ยท :vsp โ€” vertical split.
:vsp โ€” vertical split.

Each split is an independent view. Use Ctrl-W h/j/k/l to navigate.

โ–ถ Try this in the simulator

See also: Navigating Windows, Move and Resize Windows, Buffer vs Window vs Tab