Quick Reference

Normal mode

KeyAction
h j k lMove cursor
w b eWord motions
0 ^ $Line start / first non-whitespace / line end
f{char} F{char}Find forward / backward on line
t{char} T{char}Until forward / backward on line
%Matching bracket
gg GFirst line / last line
{N}gg {N}GGo to line N
/ ?Search forward / backward
n NNext / previous match
* #Search word under cursor forward / backward

Operators

KeyAction
d{motion}Delete
c{motion}Change (delete + enter insert)
y{motion}Yank (copy)
~Toggle case
gu{motion}Lowercase
gU{motion}Uppercase
> {motion}Indent right
< {motion}Indent left
=Format (lsp-format or ={motion})
gq{motion}Format / hard-wrap

Text objects

KeySelects
iw awInner / a word
iW aWInner / a WORD (non-whitespace)
is asInner / a sentence
ip apInner / a paragraph
it atInner / a tag block (HTML/XML)
i( a(Inner / a paren block
i{ a{Inner / a brace block
i[ a[Inner / a bracket block
i< a<Inner / a angle bracket block
i' a'Inner / a single-quoted string
i" a"Inner / a double-quoted string
i\`` a``Inner / a backtick-quoted string

Counts

Prefix motions and operators with a number: 3j (down 3), d5w (delete 5 words).

Visual mode

KeyAction
vCharacter-wise visual
VLine-wise visual
<C-v>Block-wise visual
oMove cursor to other end of selection
d xDelete selection
cChange selection
yYank selection
~Toggle case
> <Indent / outdent
JJoin lines

Insert mode

KeyAction
<Esc>Return to normal
<C-h>Delete character before cursor
<C-w>Delete word before cursor
<C-u>Delete to start of line
<C-r>{reg}Insert from register
<C-n> <C-p>Completion next / previous
<C-e>Cancel completion

Command-line mode (:)

CommandAction
:wWrite (save)
:qQuit current buffer
:wqWrite and quit
:q!Force quit (discard changes)
:e {file}Open file
:bn :bpNext / previous buffer
:lsList buffers
:bdDelete buffer
:split :vsplitSplit horizontal / vertical
:tabnewNew tab
:set {option}Set option
:colorscheme {name}Change theme
:{range}s/old/new/gSubstitute
:g/pattern/commandGlobal command
:!{shell cmd}Run shell command
:help {topic}Open help

Picker (<space> or :pick)

KeyAction
<C-p>File picker
<C-g>Grep / text search
<C-b>Buffer picker
<C-o>Outline / symbol picker
<C-r>Recently opened
<C-k>Pick a picker
<Esc>Close picker

Picker (within picker)

KeyAction
<C-n> <Down>Next result
<C-p> <Up>Previous result
<C-c> <Esc>Dismiss picker
<Tab>Preview selection

Multibuffer / search results

KeyAction
:search {pattern}Search project
Enter on a resultJump to source location
:cnext :cprevNext / previous result
:copen :ccloseOpen / close results

Diff mode

KeyAction
:diffthisStart diff
]c [cNext / previous hunk
doDiff obtain (get from other buffer)
dpDiff put (put to other buffer)
:diffupdateRefresh diff

Buffers and navigation

KeyAction
<C-w> h/j/k/lNavigate panes
<C-w> wCycle panes
<C-w> s/vSplit horizontal / vertical
<C-w> cClose pane
<C-w> oClose others

LSP

KeyCommandAction
K:lsp-hoverShow documentation
gd:lsp-definitionGo to definition
gD:lsp-declarationGo to declaration
gi:lsp-implementationGo to implementation
gr:lsp-referencesFind references
[d ]d:lsp-diagnostic-prev/nextPrevious / next diagnostic
<C-w> d:lsp-peek-definitionPeek definition
:lsp-renameRename symbol
:lsp-formatFormat buffer

Macros

KeyAction
q{reg}Start recording into register
q (in recording)Stop recording
@{reg}Execute macro
{N}@{reg}Execute macro N times
@@Repeat last macro

Registers

RegisterContent
"Unnamed (default yank/delete)
0Last yank
1-9Last 9 deletes
a-zNamed registers
%Current file name
#Alternate file name
/Last search pattern
:Last command
.Last inserted text
=Expression register

Marks

KeyAction
m{a-z}Set mark
'{a-z}Jump to mark line
`{a-z}Jump to mark line + column
'. `.Jump to last change position
'' ``Jump to previous position

Options

OptionDefaultDescription
tabstop4Spaces per tab
shiftwidth4Spaces per indent
expandtabtrueUse spaces for tabs
numbertrueShow line numbers
relativenumberfalseShow relative line numbers
wraptrueSoft-wrap long lines
scrolloff3Lines visible above/below cursor
sidescrolloff3Columns visible left/right of cursor
mousetrueMouse support
clipboardunnamedClipboard integration

See also