Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ACM 03/01/2012 VIM WORKSHOP

Avatar for tjk tjk
May 08, 2012

ACM 03/01/2012 VIM WORKSHOP

Avatar for tjk

tjk

May 08, 2012
Tweet

More Decks by tjk

Other Decks in Programming

Transcript

  1. Let's start with questions What is Vim? from http://www.vim.org/about.php Vim

    is a highly configurable text editor built to enable efficient text editing. It is an improved version of the vi editor distributed with most UNIX systems. Vim is often called a "programmer's editor," and so useful for programming that many consider it an entire IDE. It's not just for programmers, though. Vim is perfect for all kinds of text editing, from composing email to editing configuration files.
  2. Basics To start vim, use one of the following: usage:

    vim [arguments] [file ..] edit specified file(s) or: vim [arguments] - read text from stdin or: vim [arguments] -t tag edit file where tag ... or: vim [arguments] -q [errorfile] edit file with first error In (.bash_profile, .profile, .bashrc, .zshrc, etc.): export EDITOR=`which vim` A friend: vimtutor
  3. Basics INSERT & COMMAND mode (& VISUAL mode) Philosophy •

    Type text in insert mode • Manipulate and navigate in command mode Goal • Spend more and more time in command mode
  4. Basics INSERT & COMMAND mode (& VISUAL) from INSERT to

    COMMAND mode ESC or ^[ from COMMAND to INSERT mode lots of ways i, I, a, A, o, O (are my most used) toggle VISUAL mode v or ^V (for VISUAL BLOCK)
  5. Getting started Open Vim, press i , then type the

    following: 1) Roses are red, 2) Mud is fun, 3) Violets are blue, 4) I have a car, 5) Clocks tell time, 6) Sugar is sweet 7) And so are you. When done, hit ESC (notice the --INSERT-- disappear) Now, let's talk navigation...
  6. Getting started: navigation • NEVER use arrow keys in Vim

    ◦ (this will be a pain in the @$$ in the beginning) Think of the j as a downward pointing arrow!
  7. Learn to grok Vim grok/gräk/Verb: 1. Understand (something) intuitively or

    by empathy. 2. Empathize or communicate sympathetically; establish a rapport.
  8. Resources • vimtutor • http://vimcasts.org/ ◦ Vimcasts publishes free screencasts

    about Vim, the text editor. • http://vimgolf.com/ ◦ Pick a challenge, fire up Vim, and show us what you got.