vi editor is Case sensitive (Example: vi prog.c)

  Two modes: command (type ESC) and insertion mode (type i, a, …)

  commands in command mode

=  h/j/k/l: cursor moves ¬/¯/­/®

=  i (insert): insert before cursor, I: insert at the beginning of the line

=  a/A (append): insert after cursor/the end of a line

=  dw (delete word): delete a word and x: delete a character

=  yy(dd): 9 yy(dd) means copy(delete) 9 lines

words copied(deleted) are put in a buffer

=  p and P: paste the words stored in the buffer

=  rC: replace a character pointed to by the cursor with character C

=  .(dot)/u: redo/undo previous command

=  0/$: cursor moves to the beginning/end of a line

=  w/e: goes to next word/go to the end of the word

=  G: G goes to the end of file, nG goes to the nth line of the file

=  cwNewWord: replace the word pointed to by the cursor with NewWord

=  /Word: find the Word

=  n: find next Word

=  J: the line pointed to by the cursor is appended with the following line

=  cntl g: display file name and the number of lines in the file, etc.

=  :1,ns/int/INT/c: replace int with INT in lines 1 to n with confirmation, if c is replaced with g, it means no confirmation

=  :wq (write the file and quit),

=  :w (save):q! quit without save

=  :s prog1.c (save to file prog1.c)

=  mc: to mark a place named c and 'c to go to the marked place

=  "a5yy: to yank 5 lines to a named buffer a, and "ap to paste

=  d'a:delete from current cursor position to marker a

=  y'a: yank from current cursor position to marker a

disable vi color: ‘:syntax off’