Neovim Text Editor Cheatsheet
Visit neovim.io or the repo at GitHub
Essential Commands (Most Frequently Used)
Basic Navigation
h/j/k/l
- Left/Down/Up/Rightw
- Jump to start of next wordb
- Jump to start of previous word0
- Jump to start of line$
- Jump to end of linegg
- Go to first line of documentG
- Go to last line of document{number}G
- Go to line numberctrl+f
- Page downctrl+b
- Page up
Essential Editing
i
- Insert mode before cursora
- Insert mode after cursoro
- Insert new line below current lineO
- Insert new line above current linex
- Delete character under cursordd
- Delete current lineyy
- Copy (yank) current linep
- Paste after cursorP
- Paste before cursoru
- Undoctrl+r
- Redo
Save and Exit
:w
- Save file:q
- Quit (fails if unsaved changes):q!
- Force quit (discards changes):wq
orZZ
- Save and quit:wa
- Save all buffers
Intermediate Commands
Text Objects and Motions
e
- Jump to end of wordge
- Jump to end of previous word}
- Jump to next paragraph{
- Jump to previous paragraph%
- Jump to matching bracket*
- Search forward for word under cursor#
- Search backward for word under cursor
Advanced Editing
cc
orS
- Delete line and enter insert modeC
- Delete from cursor to end of line and enter insert modecw
- Delete word and enter insert modeciw
- Change inner wordci"
- Change inside quotesci(
- Change inside parenthesesdd
- Delete lineD
- Delete from cursor to end of lineyiw
- Yank inner word.
- Repeat last command
Visual Mode
v
- Enter character-wise visual modeV
- Enter line-wise visual modectrl+v
- Enter block-wise visual modegv
- Reselect last visual selectiono
- Move to other end of selection
Search and Replace
/pattern
- Search forward for pattern?pattern
- Search backward for patternn
- Repeat search in same directionN
- Repeat search in opposite direction:%s/old/new/g
- Replace all occurrences in file:%s/old/new/gc
- Replace all occurrences with confirmation
Advanced Features
Buffer Management
:ls
- List all buffers:bn
- Next buffer:bp
- Previous buffer:b {number}
- Go to specific buffer:bd
- Delete current buffer
Window Management
:sp
- Split horizontally:vsp
- Split verticallyctrl+w h/j/k/l
- Navigate between windowsctrl+w =
- Make all windows equal sizectrl+w _
- Maximize current window heightctrl+w |
- Maximize current window width:q
- Close current window
Tab Management
:tabnew
- Create new tab:tabn
orgt
- Next tab:tabp
orgT
- Previous tab:tabclose
- Close current tab
Marks
ma
- Set mark 'a' at current position'a
- Jump to line of mark 'a'`a
- Jump to position of mark 'a':marks
- List all marks
Registers
"ay
- Yank into register 'a'"ap
- Paste from register 'a':reg
- List registers"+y
- Copy to system clipboard"+p
- Paste from system clipboard
Macros
qa
- Record macro 'a'q
- Stop recording macro@a
- Run macro 'a'@@
- Repeat last macro
File Operations
:e filename
- Edit a file:r filename
- Insert file content:!command
- Run shell command:r !command
- Insert command output
Code Folding
zf
- Create foldzo
- Open foldzc
- Close foldzR
- Open all foldszM
- Close all folds
Terminal
:term
- Open terminalctrl+\ ctrl+n
- Exit terminal mode
Configuration
:set number
- Show line numbers:set relativenumber
- Show relative line numbers:set wrap
- Enable line wrapping:set expandtab
- Use spaces instead of tabs:set tabstop=4
- Set tab width:help {topic}
- Get help on topic