Vim Basics

Essential Vim commands and modes

Vim Modes

Normal Mode # default mode for navigation
Insert Mode # for typing text
Visual Mode # for selecting text
Command Mode # for executing commands

Mode Switching

i # enter insert mode before cursor
a # enter insert mode after cursor
Esc # return to normal mode
v # enter visual mode
: # enter command mode

Save and Quit

:w # save file
:q # quit
:wq # save and quit
:q! # quit without saving
:x # save and quit (only if changes)
ZZ # save and quit (normal mode)

Open Files

vim filename # open file
:e filename # edit file
:e! # reload current file