VIM vimtutor

Iā€™ve always wanted to be good at Vim. Iā€™ve tried to learn it a few times, but I always ended up turning it off since I never got used to it. A few days ago I just got bored and decided to go through ā€œvimtutorā€ for fun, and I think I finally got the hang of it.

If youā€™ve never heard of vimtutor before, itā€™s a built-in tutorial that comes with Vim. You can access it by typing ā€œvimtutorā€ in your terminal. It walks you through the basics of Vim and you can practice what you learn right away.

vimtutor

VIM Cheat Sheet

I took some notes while going through vimtutor and made a cheat sheet for myself. Iā€™m sharing it here in case anyone else finds it useful.

Command Description
c change
d delete
y yank (copy)
p paste
u undo
r replace
x delete character
o open line below
O open line above
i insert
a append
A append at end of line
Esc exit insert mode
:q! quit without saving
:wq write and quit
:w write (save)
:q quit
:help help
ctrl + f page down
ctrl + b page up
G go to end of file
gg go to beginning of file
shift + g go to end of file
0 go to beginning of line
$ go to end of line
w go to beginning of next word
e go to end of next word
b go back to beginning of word
% go to matching (, {, or [
:10 go to line 10
:10,20 go to line 10 to 20
/word search for word
n go to next search result
N go to previous search result
:set number show line numbers
:set nonumber hide line numbers
:set list show hidden characters
:set nolist hide hidden characters
:set wrap wrap long lines
:set nowrap donā€™t wrap long lines
:%s/old/new/g replace all old with new throughout file
:%s/old/new/gc replace all old with new throughout file with confirmations

Just remember itā€™s {operator}{number}{motion}.