You are on page 1of 2

VI Cheat Sheet

esc Toggle to command(beep) mode from an insert mode Editing commands from command mode i Insert at cursor a Append after cursor A Append at the end of the line o Open a line for editing below where the cursor is sitting O Open a line for editing above where the cursor is sitting Command mode instructions G Go to the end of the file :<number> - Go to line number :w Write the file :wq Write the file and exit vi w Skip to the next word boundary b Skip to the previous word boundary :ZZ Write and quit the file :%s/<search pattern>/<replace pattern>/g Global search and replace, leave off the g to only replace the first occurrence of the pattern in a line yy Yank(copy) the line p Put(paste) the line ?<string> - Search for string(remember it is case sensitive), N finds the next matching pattern and n finds the previous /<string> - Search for string(remember it is case sensitive), n finds the next matching pattern and N finds the previous

You might also like