Vim is a command-line editor that is included with most *nix machines and OSX.


All commands must be done in "Normal" mode, accessed by pressing esc if in write mode. Commands are case sensitive and must be confirmed with Enter unless otherwise noted.


Description Command Notes
Quit :q
Quit and do not save :cq
Save and quit ZZ No need to confirm or press enter.
Save :w
Save and quit :wq
Save only if file changed and quit :x
Save As :w newFileName


Description Command Notes
Undo u
Redo Ctrl + R


Description Command Notes
Find /searchpattern Go to next occurrence with n and previous with N
Find and Replace :1,$s/searchpattern/replacepattern To replace all, add /g to the end of the command


Description Command Notes
Go to beginning of file gg
Go to end of file G
Go to beginning of line 0 / ^
Go to end of line $

Copy (Yank), Cut, and Paste

Copy is "yank" in Vim, so that's why they are "y".

Description Command Notes
Copy entire line or n lines, including newline nyy
Copy from cursor to end of line y$
Copy from cursor to start of line y^
Cut entire line or n lines, including newline ndd
Cut from cursor to end of line d$
Cut from cursor to start of line d^
Paste after the cursor p
Paste before the cursor P


Description Command Notes
Delete line dd
Delete 3 lines 3dd
Delete from current column to end of line D


Description Command Notes
Toggle fold at next logical break za

Plugins and Packages


Last modified: 202110212237