When & why you should stay out of visual mode

802afd5856ed0054d7d1851ea21cbabe?s=47 nelstrom
January 29, 2013

When & why you should stay out of visual mode

802afd5856ed0054d7d1851ea21cbabe?s=128

nelstrom

January 29, 2013
Tweet

Transcript

  1. 29th January, 2013 Drew Neil WHEN & WHY YOU SHOULD

    STAY OUT OF VISUAL MODE
  2. v{motion}{command} VISUAL OPERATIONS (Vim at it’s most user-friendly)

  3. v{motion}{command} VISUAL OPERATIONS (Vim at it’s most user-friendly) v engage

    visual mode
  4. v{motion}{command} VISUAL OPERATIONS (Vim at it’s most user-friendly) v engage

    visual mode {motion} select the range of text to act upon
  5. v{motion}{command} VISUAL OPERATIONS (Vim at it’s most user-friendly) v engage

    visual mode {motion} select the range of text to act upon {command} execute
  6. {command}{motion} NORMAL OPERATIONS (the old-school vi way)

  7. {command}{motion} NORMAL OPERATIONS (the old-school vi way) {command} execute operation

  8. {command}{motion} NORMAL OPERATIONS (the old-school vi way) {command} execute operation

    {motion} over the specified range
  9. COMMAND EFFECT HELP {Visual}u Make highlighted text lowercase :help v_u

    gu{motion} Make {motion} text lowercase :help gu DOWNCASING
  10. gu it it u v . downcase next 3 characters

    downcase inner tag VISUAL OPERATOR OPERATOR- PENDING Vs.
  11. COMMAND EFFECT HELP {Visual}gw Format the highlighted text :help v_gw

    gw{motion} Format the lines that {motion} moves over :help gw HARD-WRAPPING
  12. gq ip ip gq v . reformat next 4 lines

    reformat inner paragraph VISUAL OPERATOR OPERATOR- PENDING Vs.
  13. FOR REPETITIVE WORK (where dot is your friend) . PREFER

    NORMAL OPERATIONS over VISUAL
  14. Operator, the true power of Vim by Kana Natsuno http://whileimautomaton.net/2008/11/vimm3/operator

    Practical Vim, Tip 23 Prefer operators to Visual commands where possible http://pragprog.com/book/dnvim/practical-vim FURTHER READING