Vim Keyboard Shortcuts
September 02, 2023 —
Gregg Szumowski
gg
Move to the first line of the fileG
Move to the last linegg=G
Reindent the whole filegv
Reselect the last visual selection<
Jump to beginning of last visual selection>
Jump to end of last visual selection^
Move to first non-blank character of the lineg_
Move the last non-blank character of the line (but you remove trailing whitespace, right)g_lD
Delete all the trailing whitespace on the lineea
Append to the end of the current wordgf
Jump to the file name under the cursorxp
Swap character forwardXp
Swap character backwardyyp
Duplicate the current lineyapP
Duplicate the current paragraphdat
Delete around an HTML tag, including the tagdit
Delete inside an HTML tag, excluding the tagw
Move one word to the rightb
Move one word to the leftdd
Delete the current linezc
Close current foldzo
Open current foldza
Toggle current foldzi
Toggle folding entirely<<
Outdent current line>>
Indent current linez=
Show spelling correctionszg
Add to spelling dictionaryzw
Remove from spelling dictionary~
Toggle case of current charactergUw
Uppercase until end of word (u for lower, ~ to toggle)gUiw
Uppercase entire word (u for lower, ~ to toggle)gUU
Uppercase entire linegu$
Lowercase until the end of the lineda"
Delete the next double-quoted string+
Move to the first non-whitespace character of the next lineS
Delete current line and go into insert modeI
insert at the beginning of the lineci"
Change what’s inside the next double-quoted stringca{
Change inside the curly braces (try [, (, etc.)vaw
Visually select worddap
Delete the whole paragraphr
Replace a character[
Jump to beginning of last yanked text]
Jump to end of last yanked textg;
Jump to the last change you madeg,
Jump back forward through the change list&
Repeat last substitution on current lineg&
Repeat last substitution on all linesZZ
Save the current file and quit Vim
Tags: cli, vim, cheatsheet, shortcuts, motd