Quick introduction to the VI editor


       vi -r (recover crashed session)


        ZZ              exit from vi, saving changes.
        :wq             exit from vi, saving changes.
        :q!             exit from vi, discarding changes.


        h               moves left one character position.
        j               moves down one line.
        k               moves up one line.
        l               moves right one character position.
                         NOTE: On many pc and video terminal keyboards, these
                         letters have arrows above them which correspond
        0       (zero)  moves to the beginning of a line.
        w               moves right one word.
        b               moves left one word.
        CTRL-u          moves up 1/2 screen full.
        CTRL-d          moves down 1/2 screen full.
        G               moves to the bottom of the file.
        nG              moves to line number   n   .
        CTRL-l          clear screen and re-draw.


        itextESC        inserts   text   to the left of the cursor.
                         Insert doesn't cause the cursor to move;  text
                         appears as it is typed, terminate with ESC.
        atextESC        appends  (inserts)   text   to the right of the
                         cursor, terminate with ESC.
        RtextESC        Replaces (overprints) characters at the cursor
                         position, terminate with ESC.
        dd              deletes the line the cursor is on.
        ndd             deletes   n   lines from the cursor position.
                           @   which is removed when the page is re-drawn.
        D               deletes characters from the cursor position to the
                         end of the line.
        x               deletes the character at the cursor.
        nx              deletes   n   characters to the right of the
        u               undo the last change.


        /pat/           positions the cursor at the next occurrence
                         of the string   pat   .

        ESC     represents the ESC key.  Press the ESC key when it is
                called for in the above commands.
        CTRL-   represents the CTRL key.  Hold the CTRL key and press the
                following key simultaneously.


        }               move down one paragraph.
        {               move up one paragraph.
        mx              save the current cursor position and label it
                        with the letter x. (x is any letter)
        'x              return to the cursor position labeled x.


        dw              delete the next word.
        .      (period) repeat last change.
        A               append at the end of the current line.
        P               put back deleted line(s).  Text deleted with D
                        and dd commands may be pasted back with the P
                        command.  Text is pasted in before the cursor
        :a,bs/old/new/  From line number 'a' to line number 'b', substitute
                        the pattern 'old' with the pattern 'new'.  You
                        carriage return in place of the 'old' and 'new'
                        strings.  Use CTRL-G to tell what line the cursor is

        //              search for the next occurrence of a previously
                        specified search string.


Cut and Paste           Move to the begining of the text to cut.  Use dd
                        to delete (cut) several lines.  Use D to cut only
                        wish to paste the text.  Use yy to copy several
                        lines.  Use P to put back the text. You may need
                        to clean up the spacing after pasting.