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.
| Command | Action |
|---|---|
:e {file} | Edit (open) a file in a new buffer |
:ls or :ls | List all buffers |
:b {n} | Switch to buffer number n |
:bn | Switch to next buffer |
:bp | Switch to previous buffer |
:bd | Delete (close) current buffer |
Windows
A window is a viewport onto a buffer. Windows split the screen.
| Command | Action |
|---|---|
:split or Ctrl-w s | Split horizontally |
:vsplit or Ctrl-w v | Split vertically |
Ctrl-w h/j/k/l | Navigate to window (left/down/up/right) |
Ctrl-w H/J/K/L | Move window to edge |
Ctrl-w = | Equalize window sizes |
Ctrl-w _ | Maximize current window height |
Ctrl-w | | Maximize current window width |
Ctrl-w o | Close all other windows (only) |
Ctrl-w c | Close current window |
Ctrl-w q | Quit current window |
Tabs
A tab is a collection of window layouts. Think of it as a workspace.
| Command | Action |
|---|---|
:tabnew | New tab |
gt | Go to next tab |
gT | Go to previous tab |
:tabclose | Close current tab |
:tabo | Close 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).