VI Commands


          To move:    h (left)       j (down)       k (up)       l (right)

          Delete line:                                    dd
          
          Delete from the cursor to the end of a word:    dw

          Delete from the cursor to the end of a line:    d$

          To undo the last action only:                   u   (lowercase u)
          To undo all the changes on a line:              U   (capital U)

          To replace text that has already been deleted:  p

          To replace the character under the cursor:      r

          To replace from the cursor to the end of word:  cw
          To replace from the cursor to the end of line:  c$
          
          Copy one line:                                  yy
          
          Copy multiple lines (4 yy with copy 4 lines):   # yy
          
          Paste line:                                     p
          
          Ctrl-g  displays your location in the file and the file status.
          Line number followed by Shift-G moves to that line number.

          Typing % while the cursor is on a (,),[,],{, or } locates its matching pair.

          To substitute new for the first old on a line type    :s/old/new
          To substitute new for all 'old's on a line type       :s/old/new/g
          To substitute phrases between two line #'s type       :#,#s/old/new/g
          To substitute all occurrences in the file type        :%s/old/new/g
          To ask for confirmation each time add 'c'             :%s/old/new/gc

          :#,# FILENAME  saves the lines # through # in file FILENAME.

          :r FILENAME  retrieves disk file FILENAME and inserts it at cursor position.

          Typing o opens a line BELOW the cursor and places you in insert mode.
          Typing a capital O opens the line ABOVE the line the cursor is on.

          Typing a capital R enters replace mode until  is pressed to exit.

          Typing ":set xxx" sets the environment variable "xxx"
          
          Save file :w
          Save and quit :wq