10 Useful VI commands
Here are a few VI commands that I use allot and find very useful.
Once in command mode (by pressing ESC) enter:
To Save or Write and document and quit VI
To save the document
To quite the document WITHOUT saving.
Capital J will join next line down on to the end of your current line.
Capital Go will take you to the end of document.
Control G displays the current line number
Enter a colon then a number to go to that line number
Move the current line to line number n
old_string is the the string you want to replace
new_string is the new string you want to replace the old string with
g to make the changes globally through the whole document.
If you want to remove a string, simply leave out the new_string so the command like like this: :%s/old_string//g
The symbol above the number 6 on the keyboard means the start of the line.
new_string is the string you want to add to the start of every line.