Vi and Vim Commands I Always Forget

Here is where I will paste Vi and Vim commands, some of which I always forget and have to look up. Seeing as you've found this page, maybe it'll be of some use to you too.

Search and Replace

Search and replace on the current line only

:s/findthis/replacewith/g

Search and replace through the whole document

:%s/findthis/replacewith/g

Deletion

Delete Word

dw

Delete 5 Words

d5w

Delete Line

dd

Delete 10 Lines

10dd

Undo

u

Change Case

~

I'll add more useful Vi commands later

Page Updated 08/02/10