← Back to overview

Buffers, Windows, and Tabs

Neovim has a three-level hierarchy that confuses newcomers:

Buffers

A buffer is a loaded file in memory. Multiple buffers can be open simultaneously.

CommandAction
:e {file}Edit (open) a file in a new buffer
:ls or :lsList all buffers
:b {n}Switch to buffer number n
:bnSwitch to next buffer
:bpSwitch to previous buffer
:bdDelete (close) current buffer

Windows

A window is a viewport onto a buffer. Windows split the screen.

CommandAction
:split or Ctrl-w sSplit horizontally
:vsplit or Ctrl-w vSplit vertically
Ctrl-w h/j/k/lNavigate to window (left/down/up/right)
Ctrl-w H/J/K/LMove window to edge
Ctrl-w =Equalize window sizes
Ctrl-w _Maximize current window height
Ctrl-w |Maximize current window width
Ctrl-w oClose all other windows (only)
Ctrl-w cClose current window
Ctrl-w qQuit current window

Tabs

A tab is a collection of window layouts. Think of it as a workspace.

CommandAction
:tabnewNew tab
gtGo to next tab
gTGo to previous tab
:tabcloseClose current tab
:taboClose all other tabs

Tip: Most users prefer buffers over tabs. Tabs are best used for completely separate contexts (e.g., one tab for code, one for tests).