Split Panes and Window Navigation

The Vim Browser Editor supports window splits, just like desktop Vim. A split divides the editing area into two or more panes so you can view different files at once, or the same file from two scroll positions. Each pane has its own cursor, scroll position, and status bar; only the focused pane receives your keystrokes.

Windows vs. buffers

A buffer is an open document in memory. A window (pane) is a viewport onto a buffer. Two panes can show the same buffer at once — useful for comparing distant sections of a long file — or each pane can show a different buffer.

When splits are active, the buffer tab bar is hidden to save space. Switch documents in the focused pane with :b, :bn, or :ls instead.

Creating splits

Enter Command mode with :, then run one of these commands. Focus moves to the new pane after the split.

Vertical split (side by side)

These commands open a new pane to the right of the current one:

  • :vs, :vsp, or :vsplit — split without a filename; the new pane shows the same buffer as the current pane (independent scroll and cursor).
  • :vs notes.txt — open notes.txt in a new pane. The original pane keeps its current file.

Horizontal split (stacked)

These commands open a new pane below the current one:

  • :sp or :split — split the current buffer into a stacked layout.
  • :split readme.md — open a file in the lower pane.

You can nest splits in either direction. For example, run :vs for a side-by-side layout, focus a pane, then run :sp to split that pane horizontally.

Focusing a pane

  • Click anywhere in an inactive pane to move focus there.
  • Keyboard: press Alt+W, then a direction key. In a side-by-side layout, use h (left) and l (right). In a stacked layout, use k (up) and j (down).

Desktop Vim uses Ctrl+W, but browsers reserve that shortcut to close tabs, so this editor uses Alt+W as the window prefix instead.

The focused pane is where Normal-mode commands, Insert mode, and saves apply. Each pane's status bar at the bottom shows that pane's filename, mode, and cursor position.

Closing panes

  • :close — close the focused pane when more than one pane is open.
  • :q — close the focused pane if it has no unsaved changes. If there are unsaved edits, Vim reports No write since last change (add ! to override); use :q! to discard and close.
  • Alt+W then c — close the focused pane (same as :close).
  • Alt+W then q — close the focused pane and discard unsaved changes.
  • :only or Alt+W then o — close every pane except the focused one.

Closing a pane does not delete a buffer if another pane still shows it. When the last pane showing a buffer is closed, the buffer is removed from your open file list.

Editing the same file in two panes

When two panes display the same buffer, text changes in one pane appear in the other immediately. Each pane keeps its own cursor position and scroll offset, so you can edit in one pane while keeping another section visible for reference.

Quick reference

ActionCommand
Vertical split (same file):vs
Vertical split (open file):vs filename
Horizontal split (same file):sp
Horizontal split (open file):split filename
Move focus (side by side)Alt+W h / l
Move focus (stacked)Alt+W k / j
Close focused pane:close or Alt+W c
Close other panes:only or Alt+W o
List open buffers:ls or :buffers
Switch buffer in focused pane:b 2 or :b filename

Current limitations

  • Panes share space evenly; drag-to-resize dividers are not available yet.
  • :wq saves the file but does not close a pane; use :w then :close or :q.

For the full list of supported commands, see the cheat sheet. New to Vim? Start with the practical guide or browse all documents.

Open the editor and try a split

Advertisement