env.dev

Neovim Cheat Sheet

Essential Neovim commands and keybindings: modes, navigation, editing, text objects, search, windows, buffers, macros, and more.

A quick reference for Neovim commands and keybindings. Covers navigation, editing, search, windows, and more.

Modes

KeyDescription
iEnter Insert mode before cursor
aEnter Insert mode after cursor
oOpen new line below and enter Insert mode
OOpen new line above and enter Insert mode
vEnter Visual mode (character selection)
VEnter Visual Line mode
Ctrl+vEnter Visual Block mode
REnter Replace mode
EscReturn to Normal mode

Navigation

KeyDescription
h / j / k / lMove left / down / up / right
w / bJump forward / backward by word
eJump to end of word
0 / $Jump to start / end of line
^Jump to first non-blank character
gg / GJump to first / last line
{number}GJump to line number
{ / }Jump to previous / next paragraph
Ctrl+d / Ctrl+uScroll half page down / up
Ctrl+f / Ctrl+bScroll full page down / up
%Jump to matching bracket
H / M / LJump to top / middle / bottom of screen

Editing

KeyDescription
xDelete character under cursor
ddDelete (cut) current line
DDelete from cursor to end of line
ccChange (delete and enter Insert mode) current line
CChange from cursor to end of line
yyYank (copy) current line
p / PPaste after / before cursor
uUndo
Ctrl+rRedo
.Repeat last change
JJoin current line with next
~Toggle case of character under cursor
>> / <<Indent / unindent current line

Text Objects & Operators

CommandDescription
diwDelete inner word
ciwChange inner word
yi"Yank text inside double quotes
da(Delete around parentheses (including parens)
ci{Change inside curly braces
ditDelete inside HTML/XML tag
vipVisually select inner paragraph
gUiwUppercase inner word
guiwLowercase inner word

Search & Replace

CommandDescription
/patternSearch forward for pattern
?patternSearch backward for pattern
n / NJump to next / previous match
*Search forward for word under cursor
#Search backward for word under cursor
:s/old/new/Replace first match on current line
:s/old/new/gReplace all matches on current line
:%s/old/new/gReplace all matches in file
:%s/old/new/gcReplace all with confirmation
:nohClear search highlighting

Windows & Splits

CommandDescription
:sp [file]Horizontal split
:vsp [file]Vertical split
Ctrl+w h/j/k/lNavigate between splits
Ctrl+w wCycle through splits
Ctrl+w =Equalize split sizes
Ctrl+w +/-Increase / decrease split height
Ctrl+w >/<Increase / decrease split width
Ctrl+w qClose current split
Ctrl+w oClose all other splits

Tabs & Buffers

CommandDescription
:e <file>Open file in current buffer
:bn / :bpNext / previous buffer
:bdDelete (close) current buffer
:lsList all open buffers
:b <name>Switch to buffer by partial name
:tabnew [file]Open file in new tab
gt / gTNext / previous tab
:tabcloseClose current tab

Marks & Jumps

CommandDescription
maSet mark a at cursor position
'aJump to line of mark a
`aJump to exact position of mark a
:marksList all marks
Ctrl+oJump to previous position in jump list
Ctrl+iJump to next position in jump list

Macros

CommandDescription
qaStart recording macro into register a
qStop recording macro
@aPlay macro from register a
@@Replay last played macro
10@aPlay macro a 10 times

Command-Line Mode

CommandDescription
:wSave current file
:qQuit (fails if unsaved changes)
:wq / :xSave and quit
:q!Quit without saving
:waSave all open buffers
:!<cmd>Run shell command
:r !<cmd>Insert output of shell command
:set numberShow line numbers
:set relativenumberShow relative line numbers
:terminalOpen built-in terminal