Command mode (ESC)
K Move up one line
J Move down one line
H move one line to the left
L Move Right One line
6j Move Down 6 rows
5k Move up 5 rows
0 Place the cursor at the beginning of a row
$ put a cursor at the end of a line
W move a cursor to the next word
b move the cursor to the previous word
CTRL + B Roll back one screen
CTRL + F roll forward one screen
: x moves the cursor to the X row
: 3 Moves the cursor on the third row
: Set NU Displays line number
/what/What to look for (remember two times ESC after entering this command)
: Q Exit VI Editor
: W Save Content
: Wq Save and exit
: q! : w! : wq! There is no protection against direct execution.
ZZ Save and exit
: X Save and exit
: w filename Saves the file as Filenema
: e! Open File last successfully written version (no current action saved)
J merges the current row with the following line
YY Copy Current line contents
YW copy the current word content
P (lowercase p) Place the copied text behind the cursor
P (uppercase p) places the copied text in front of the cursor
\< matches the beginning of a word
\> matches the end of a word
: The s/old/new/substitution command modifies only one
: S/old/new/g Modify Current line (g:globally)
x,ys/old/new/replace x rows to Y lines with the first of each row
x,ys/old/new/g replace x line to Y line with all
: 1, $s/old/new/g replace all of the text
: 1, $s/old/new/gc the user must enter Yes or no to confirm each modification
: 1, $s/\*/hello/g replace * in text with Hello
: 1. $s/\<the/none/g to replace the beginning of the
VI Editor BASIC commands