Vim for Fun

Individual pages:
1a 1b 2a 2b 2c 2d 2e 2f 2g 2h 2i 2j 2k 2l 2m 2n 2o 2p 2q 2r 2s









                 Vim For Fun
                 -----------


            Andy Balaam, 2013-08-23








    Before we start
    ---------------

    To quit vim (or vi):

    1. Don't panic

    2. Press Esc a few times

    3. Type :q!


Notes:

The exclamation mark is not for emphasis.

This loses your work.  To save and exit
type :wq instead.


               Contents
               --------

               Vim is:

               - Fast

               - Keyboard-driven

               - Powerful

               - Programmable

               - Fun








               Vim is Fast
               -----------

               - Because it is old

               - I mean really old










     (btw that makes it pretty stable too)



               Vim is Fast
               -----------

               - Snappy response

               - Large files

               - Large numbers of files

               - Long lines










     (btw that makes it pretty stable too)



              Vim is keyboard-driven
              ----------------------

     - Everything is done with the keyboard

     - Using a combination of:

        - keyboard shortcuts

        - multiple modes

        - typed commands




       (btw this makes automation easy.)



                 Vim modes
                 ---------

        - Normal (for getting around)
           (press Esc to get back here)

        - Insert (for typing text)

        - Visual (for selecting text)

        - Several others










                 Normal mode
                 -----------

  Moving around:

    up, down, left and right (or hjkl)
    w  - next word
    e  - end of next word
    {  - previous empty line
    }  - next empty line
    gg - top
    G  - bottom
    ^  - start of line
    0  - really start of line
    $  - end of line
    %  - matching bracket

    .  - repeat last command




                 Normal mode
                 -----------

  Searching:

    / - search for pattern
    ? - search backwards
    n          - next match
    N          - previous match












                 Normal mode
                 -----------

  Editing:

    i,I,a,A - go into insert mode
    dd      - delete line
    >>      - indent line
    <<      - dedent line
    ~       - switch case
    d - delete something
    c - delete and go into insert mode
    r - replace with 

  Repetition:

     - do it number times
      e.g. 20w means go forward 20 words


                 Normal mode
                 -----------

  Undo/redo:

    u      - undo
    Ctrl-r - redo

  Repeat:

    . - do the last thing you did again









                 Normal mode
                 -----------

  Copying ("yanking"):

    yy      - copy this line
    y - copy something e.g:
      yw - copy this word
      y$ - copy to end of line

  Pasting:

    p - paste
    P - paste before here






                 Insert mode
                 -----------

  To start typing:

    i - insert text here
    a - insert text after this char
    I - at start of line
    A - at end of line


  Some keyboard shortcuts are available while
  typing.  My favourite is:

    Ctrl-p - completion





                 Visual mode
                 -----------

  To enter visual mode:

    v      - start selecting text
    V      - start selection whole lines
    Ctrl-v - start rectangular selection

  To select stuff:

    All the same movement keys as in normal mode

  To do stuff to the selection:

    Many of the same changing things key as in
    normal mode, plus commands...



              Command line mode
              -----------------

  To run a command (from normal mode):

    : args

  E.g.

    :s/foo/bar/g - search and replace

    :w     - save
    :e     - load
    :ls          - list open files
    :bn          - next file
    :bp          - previous file
    :    - jump to line
    :q           - quit


              Vim is powerful
              ---------------

    There are too many features to list.

    Examples:

    - Split windows and "tabs"
    - Interactive search and replace
    - Registers
    - Markers
    - Customisable highlighting
    - All the basic features e.g. line numbers
    - Folding
    - Syntax highlighting
    - Many, many commands




             Vim is programmable
             -------------------

    - 4000 plugins on vimscripts.org

    - Everything you do can be recorded and
      played back.

    - Example plugins:

      - On-the-fly compiling and syntax check
      - Buffer listing and navigation
      - Eclipse navigation and refactorings
      - Code completion
      - So many things I don't understand...





                  Vim is Fun
                  ----------





                  vimgolf.com











0.173 0.499 0.764 0.938 1.000 0.927 0.527
0.985 0.867 0.645 0.346 0.005 -0.376 -0.850
[0.173, 0.985]
[0.499, 0.867]
[0.764, 0.645]
[0.938, 0.346]
[1.000, 0.005]
[0.927, -0.376]
[0.527, -0.850]











                  More Info
                  ---------


        Videos   - youtube.com/user/ajbalaam

        Twitter  - @andybalaam

        Projects - artificialworlds.net






 Font: SarcasticRobot by Chank
 http://www.chank.com/font-SarcasticRobot