Table of Contents

vi

vi Editor "Cheat Sheet" (pdf) (dead link)
Vi Lovers Home Page
SS64 - The vi editor (visual editor) - A quick reference guide
The Register - Bill Joy's greatest gift to man – the vi editor

Search and replace text in entire document

Replace all occurrences of the word “old” with “new”:

:1,$s/old/new/

Source:Search and replace with vi -- part 1

To replace text with slashes:

:1,$s;/var/backups/;/backup/once/;

To replace all occurrences of the string on the same line add a 'g' as suffix of the command. Example:

:1,$s;/var/backups/;/backup/once/;g

Delete lines matching pattern

:1,$g/lines containing this text will be deleted/d

Source:alvin alexander - A vim pattern search and delete example