Editor · keyboard first

Vim / Neovim

Modes, movement, and editing without taking your hands off the keyboard. Search by action or shortcut, and copy commands when useful.

normal · insert · visualsearchable referencekeys and commands

Modes and quitting

Most keys do different things depending on the current mode.

Switch modes

basics

Esc — Normal mode; i — insert before the cursor; a — append after it; o — open a new line below and insert.

Insert: I at the start of the line, A at the end, O to open a line above.

Save and quit

Ex commands
:w save :q quit :wq or :x save and quit :q! quit without saving

Tip: press Esc first, then type a command beginning with a colon.

Motion

Combine motion with operators: for example, d} deletes through the end of the paragraph.

Basic movement

Normal

h / j / k / l — left / down / up / right. 0 — start of line, ^ — first non-blank character, $ — end of line.

gg — start of file; G — end of file; 42G — line 42. H / M / L — top / middle / bottom of screen.

Words and paragraphs

Normal

w — next word start; b — previous word start; e — word end. Uppercase W, B, E treat whitespace-delimited text as a word.

{ / } — previous / next paragraph; % — matching bracket; Ctrl+d / Ctrl+u — scroll half a screen.

Find a character on the line

Normal

f{char} — land on the character; t{char} — stop before it. Uppercase F and T search backward. ; repeats; , repeats in the opposite direction.

Editing

Vim grammar: operator + text object or motion. A count repeats the operation.

Delete and change

d / c

dd — delete line; dw — to next word; diw — inner word; d$ — to line end; x — character under cursor.

cc — change line; ciw — change word; C — change to line end. 2dd deletes two lines.

Yank and paste

y / p

yy — yank line; yw — yank word; y$ — to line end. p pastes after / below; P before / above.

Undo and repeat

history

u — undo; Ctrl+r — redo; . — repeat the last change. A single insert session is one change if you leave Insert mode in one go.

Visual selection

Visual

v — characterwise; V — linewise; Ctrl+v — blockwise. Then use d to delete, y to yank, or > / < to indent.

Windows, tabs, and buffers

A buffer is an open file; a window is a view onto a buffer.

Split a window

split

:split / :sp — horizontal; :vsplit / :vs — vertical. Move with Ctrl+w, then h/j/k/l. Ctrl+w q closes a window.

Buffers

buffers

:ls — list buffers; :b name — switch; :bnext / :bprev — next / previous; :bd — delete a buffer.

Tabs

tabs

:tabnew file — new tab; gt / gT — next / previous; :tabclose — close tab.

Neovim-specific

Commands and built-in features specific to Neovim.

Built-in terminal

Neovim

:terminal opens a terminal in the current window; :split | terminal or :vsplit | terminal opens one in a split. To return to Normal mode from Terminal mode, press Ctrl+\, then Ctrl+n.

Configuration

Neovim

Main config paths: ~/.config/nvim/init.lua or ~/.config/nvim/init.vim. Reload the current Lua config with :luafile %.

LSP diagnostics

Neovim 0.5+

With an LSP configured, :lua vim.diagnostic.open_float() shows diagnostics at the cursor; :lua vim.diagnostic.goto_next() / goto_prev() move between them.

System clipboard

Neovim

Clipboard integration may need clipboard support in the build or an external provider (for example, wl-clipboard on Wayland). In Lua config: vim.opt.clipboard = "unnamedplus".

Mappings can differ due to user configuration, plugins, or keyboard layout. Inspect your mappings with :map.