Navigation
h, j, k, l– Move left, down, up, right (respectively)gg– Go to the first line of the documentG– Go to the last line of the documentw– Jump forwards to the start of a wordb– Jump backwards to the start of a word0– Jump to the start of the line$– Jump to the end of the lineCtrl + f– Page downCtrl + b– Page up
Editing
x– Cut (delete) the character under the cursorr– Replace the character under the cursorccorS– Change (replace) an entire linecw– Change (replace) to the end of a wordciw– Change (replace) entire wordC– Change (replace) to the end of the lined– Deletedd– Delete an entire linedw– Delete the word
Copy-Paste
yyorY– Yank (copy) a lineyw– Yank (copy) the wordp– Paste after the cursorP– Paste before the cursor
Undo/Redo
u– UndoCtrl + r– Redo
Search and Replace
/pattern– Search for a pattern in the document?pattern– Search backward for a patternn– Repeat the search in the same directionN– Repeat the search in the opposite direction:%s/old/new/g– Replace all occurrences of “old” with “new” in the document:%s/old/new/gc– Replace all occurrences with confirmation
Miscellaneous
:w– Save the file:q– Quit Vim:wqor:x– Save and quit:q!– Quit without saving:e filename– Open a file:splitor:vsp– Split the window:help– Access Vim’s built-in help
Reference: https://vim.rtorr.com/
