Command Cheatsheet

Command Cheatsheet

Motions

KeysMotion
h j k lleft, down, up, right
w / bnext / previous word
0 / $start / end of line
gg / Gtop / bottom of file
{n}Ggo to line n
f{char}jump onto the next char in the line
{ / }previous / next paragraph

Editing

KeysAction
i / ainsert before / after the cursor
o / Oopen a line below / above
dd yydelete / yank the line
p / Ppaste after / before
ciwchange inner word
.repeat the last change
u / <C-r>undo / redo
r{char}replace the character under the cursor
ggdGdelete the whole file
:%s/a/b/gsubstitute across the whole file

Files and windows

Keys / cmdAction
:e {file}edit a file
:w :q :wq :q!write / quit / both / force-quit
<C-w>s / <C-w>vsplit horizontal / vertical
<C-w>oclose every other window

The modern setup’s leader map

Leader is <space>. Families, as configured in the course repo:

KeysAction
<leader><space>smart file picker
<leader>fglive grep the project
<leader>efile explorer
]h / <leader>hpnext hunk / preview hunk
<leader>gglazygit
<leader>gddiffview
<leader>db / dc / do / dtbreakpoint / continue / step over / terminate
<leader>ta / tf / tsrun all tests / file / summary panel
<leader>xxtrouble diagnostics panel
<leader>zzen mode
gcctoggle comment
gSsplit / join arguments
grn / grr / gdLSP rename / references / definition
Khover documentation

LSP defaults worth memorizing (Neovim 0.11+)

grn rename · gra code action · grr references · gri implementation · gO document symbols · [d / ]d diagnostic jump · K hover