Vim Checklist

This is a easy access vim checklist that has examples along with the commands and description.

Normal Mode

When entering into vim, you enter normal mode. Command mode is where most of the commands in vim will be used.

CommandDescriptionExample
EscEntering normal mode (if not already in)
:w : write to the file:q : quit the file if nothing written:q! : force quit even with written textquitting/writing to vim
:!Running shell commands from vim
:set number : normal line numbers<>:set relativenumber : line numbers are relativeMake vim have line numbers
Ex: 5 (goes 5 lines down)Typing a number x before a vim command makes you do that command x many times
h : move leftj : move downk : move upl : move rightMoving around (arrow keys also works)
u : undo (undoes whatever you just did in the last insert mode only)Ctrl + r : redoundo/redo previous actions
dd : delete entire lineShift + d : delete the rest of the line from where cursor isDeleting text
yy/Shift + yCopy entire line
cc : Change the line (delete but also puts you in insert mode after)Shift + c : Changes the rest of the line (changes from where cursor is to the end of the line)Changing in vim (like delete but leaves you in insert mode after)
rReplace character cursor is on
p : paste textShift + p : paste text on line above cursor positionPasting text
w : move forward a word (this consideres a word separated by hyphens or other searators as well besides spaces)Shift + w : move forward a word (only delimiter is a space)b : move backward a word (same conditions as moving forward)Shift + b : move backward a word (same conditions as moving forward)e : jump to the end of the current word0 : go to the beginning of the line (without entering insert mode)$ : go to the end of line (without entering insert mode)Moving across text
dw : deletes a word in front of cursor position(number x)dw : deletes x many words in frontd0 : delete everything until the start of lined$ : delete everything until end of lineCombining vim commands examples
These all can be ci, di<something, yi diw : deletes the wordciw : changes the wordyiw : copy the word you are inside ofdi" : deletes everything inside two quotation marksci" : changes everything inside two quotation marksyi" : copy everything inside quotesOptions when inside a word (cursor is like in the l part of hello)
% : go back and forth across a pair of chars (() [] {}) Only in current line  t : jump to the right before the char in the line   f : jump to on the char in the line  Shift + t : same as t but backwards  Shift + f : same as f but backwards gg : jump to beginning of file Shift + g : jump to end of file + Shift + g : jump to line numberJumping/Finding text
» : Shift text to the right« : Shift text to the leftIf in visual mode and selecting text then only have to do once (> or <)== : indent line correctly (good for programming)gg=Shift + g : If the entire file is badly indentedIndeting/Shifting
/(search term) : jumps to next occurrence of (search term) from where cursor is at?(search term) : jumpts to previous occurrence of (search term) from where cursor is atn : jumps to next occurrence of (search term)Shift + n : jumpts to previous occurrence of (search term)Selected text in visual mode# : goes to previous term of the highlighted text* : goes to next term of the highlighted textSearching/Replacing
m(character) : creates a waypoint to that line’(character) : goes to that waypoint:marks : view all waypointsVim waypoints (like a portal back to a certain registered waypoint) (can also be through different files)
zzCenter line to the middle of screen
. : execute command that was last runRepeat command
:reg : pull up the list of all the saved content"(char)p : paste a certain text from register or (name)p because the Name is the title of it(name)(command) : does some command to that line in the registerVim registers

Insert Mode

Insert mode will be used to do all the typing/programming.

CommandDescriptionExample
i : type before where the highlighted cursora : type after the highlighted cursoro : create a new line below and enter insert modeShift + i : go to beginning of current line and enter insert modeShift + a : go to end of current line and enter insert modeShift + o : create a new line above and enter insert modeEntering Insert Mode

Visual Mode

Visual mode will be used to do different things to characters/lines of text.

CommandDescriptionExample
vEnter Visual Mode
Arrow keysSelect text
dDelete selected text
cDeletes selected text and enters insert mode where cursor is}
y : yank/copy the textp (in normal mode) : paste the textCopy/Paste selected text
Shift + vVisual Line mode (only select lines)
Ctrl + vVisual Block mode (select by columns)

Other Useful Vim tricks

These are some other random useful tricks that you might want to know when using vim.

TrickDescriptionExample
~/.vimrcVim config file so you don’t have to type configs everytime