Neovim keyboard shortcuts

Neovim keeps Vim's modal editing model and adds built-in behavior around it. This reference covers the core motions and operators plus the LSP, commenting, diagnostic, and terminal-mode defaults that distinguish a current Neovim session from a plugin-specific setup.

Windows, macOS, Linux · 72 shortcuts

Modes and movement

Move through a buffer in normal mode, enter or leave insert mode, and use motions as the grammar for edits.

ActionWindowsmacOSLinux
Insert before the cursoriii
Insert after the cursoraaa
Open a new line belowooo
Open a new line aboveOOO
Return to normal modeEscEscEsc
Move lefthhh
Move downjjj
Move upkkk
Move rightlll
Move to the first non-blank character0 moves to column one.^^^
Move to the end of the line$$$
Move to the next wordwww
Move to the previous wordbbb
Move to the start of the filegggggg
Move to the end of the fileGGG
Jump to a matching bracket%%%

Language server defaults

When an LSP client attaches, these built-in normal- and insert-mode mappings expose navigation, rename, actions, symbols, links, signatures, and hover information.

ActionWindowsmacOSLinux
Rename the symbol under the cursorgrngrngrn
List references to the symbolgrrgrrgrr
List implementationsgrigrigri
Go to the type definitiongrtgrtgrt
Run the code lens under the cursorgrxgrxgrx
Go to the definitiongdgdgd
Go to the declarationgDgDgD
Show hover informationKKK
Select a code actiongragragra
Open document symbolsgOgOgO
Show signature help in Insert modeCtrlsCtrlsCtrls
Jump to the tag or definition under the cursorThe attached LSP client can provide the tagfunc result.Ctrl]Ctrl]Ctrl]
Open the tag or definition in a splitThe attached LSP client can provide the tagfunc result.Ctrlw]Ctrlw]Ctrlw]
Preview the tag or definition in a new windowThe attached LSP client can provide the tagfunc result.Ctrlw}Ctrlw}Ctrlw}
Format lines through the attached language servergq remains the core format operator; with LSP, formatexpr routes it to the server when supported.gqgqgq
Trigger omnifunc completionAn attached LSP client sets omnifunc when it supports completion.CtrlxCtrloCtrlxCtrloCtrlxCtrlo

Commenting and diagnostics

Use Neovim's built-in commenting and diagnostic mappings when the filetype or attached language tooling provides the required support.

ActionWindowsmacOSLinux
Toggle the comment on the current linegccgccgcc
Toggle comments over a motion or selectionUse a motion or Visual selection to choose the range.gcgcgc
Jump to the previous diagnostic]d jumps to the next one.[d[d[d
Jump to the first diagnostic in the buffer]D jumps to the last diagnostic.[D[D[D
Jump to the last diagnostic in the buffer[D jumps to the first diagnostic.]D]D]D
Show diagnostics in a floating windowCtrlwdCtrlwdCtrlwd
Jump to the previous quickfix item]q jumps to the next quickfix item.[q[q[q
Jump to the next quickfix item[q jumps to the previous quickfix item.]q]q]q

Treesitter selection defaults

With a Treesitter parser, these Visual-mode mappings select syntax nodes; Neovim can fall back to LSP selection ranges for the parent and child commands.

ActionWindowsmacOSLinux
Select the parent syntax nodean is the Visual-mode command; it expands to a parent node.vanvanvan
Select the previous or first child syntax nodein is the Visual-mode command; it narrows to a child node.vinvinvin
Select the next syntax nodev]nv]nv]n
Select the previous syntax nodev[nv[nv[n
Expand the selection to the next syntax nodev]Nv]Nv]N
Expand the selection to the previous syntax nodev[Nv[Nv[N

Windows and terminal mode

Split the editor and move between windows, then leave terminal mode when a running program has captured the keyboard.

ActionWindowsmacOSLinux
Split the window horizontallyCtrlwsCtrlwsCtrlws
Split the window verticallyCtrlwvCtrlwvCtrlwv
Move to the next windowCtrlwwCtrlwwCtrlww
Move to the window on the leftCtrlwhCtrlwhCtrlwh
Move to the window belowCtrlwjCtrlwjCtrlwj
Move to the window aboveCtrlwkCtrlwkCtrlwk
Move to the window on the rightCtrlwlCtrlwlCtrlwl
Open a terminal bufferPress Enter after the :terminal command.:terminal:terminal:terminal
Leave terminal mode for normal modeCtrl\CtrlnCtrl\CtrlnCtrl\Ctrln
Jump to the previous shell commandRequires shell integration that emits OSC 133 markers.[[[[[[
Jump to the next shell commandRequires shell integration that emits OSC 133 markers.]]]]]]

Make a printable Neovim sheet