neovim shortcuts
I'm trying to learn neovim more thoroughly. It's heavily shortcut based that I need to learn little by little. Here is a list to help me memorize them:
Neovim Shortcuts Summary
Editing
D— Delete to end of lined$— Same asD3D— Delete to end of line, 3 linesd0— Delete backward to the start of the linedw— Delete word forwarddb— Delete word backwarddB— Delete word backward (incl. punctuation)$dB— Delete last word of the lineggVG— Select entire buffer"+y— Yank selection to system clipboard-
ggVG"+y— Select + copy whole buffer to clipboard -
astart editing after the current cursor position Astart editing at the very end of the current lineistart editing on the current cursor positionIstart editing at the first non-blank character of the current linedstart editing on a brand new line below the cursorOstart editing on a brand new line above the cursor.
Comments
- Visual mode:
gctoggle line comment - Visual mode:
gbtoggle block comments - Normal mode:
gcctoggle comment on the current line - Normal mode:
gbctoggle a block comment on the current line - Normal mode:
gc+ motion, comment out text defined by a motion
Indentation
- Visual mode:
>indent to the right - Visual mode:
<indent to the left - Normal mode:
>>indent to the right - Normal mode:
<<indent to the left
Windows / Splits
Ctrl-w v— Vertical splitCtrl-w s— Horizontal split:vsp filename— Vertical split with new file:sp filename— Horizontal split with new file:q/Ctrl-w q— Close current splitCtrl-w c— Close current split:close— Close current window (not last one):only/Ctrl-w o— Close all other splits
Tabs
:tabnew file— Open file in new tabgt/gT— Next / previous tab:tabclose— Close current tab:tabs— List all tabs2gt— Jump to tab 2
LSP / Diagnostics
gd— Go to definitiongD— Go to declarationgi— Go to implementationgr— Go to referencesK— Hover docs<leader>rn— Rename symbol<leader>ca— Code action<C-k>— Signature help<leader>e(custom) — Open diagnostic float<F5>— DAP: continue<F10>— DAP: step over<F11>— DAP: step into<leader>b(custom) — Toggle breakpoint<leader>x(custom, trouble.nvim) — Toggle diagnostics panel<leader>sS— Show workspace symbols<leader>ss— Show document symbols
File browser
<leader>ff— Find files<leader>fg— Live grep (requires rgrep)<leader>fb— List buffers<leader>fh— Help tags<leader>fo— Recently opened files
Command-line / Ex Commands
:%s/.../.../g— Substitute over whole buffer:g/^ /d— Delete all lines starting with two spaces:g/^ /— Preview matches without deleting:g/^ /normal dd— Delete matches via global+normal:make— Run build (viamakeprg):copen— Open quickfix list:checkhealth nvim-treesitter— Check treesitter health:checkhealth provider— Check clipboard provider
Misc
:qa— Quit vim and all buffers<leader>— Custom prefix key, default\, commonly remapped toSpaceviavim.g.mapleader = " "