Vim for Newbies

An Introduction to Vim

Alex LaFroscia      @alexlafroscia

A Quick History

About Vim

  • Created in 1991
  • Runs in a terminal window
  • Liked for speed, customization

Why Use Vim?

  • Very portable configuration
  • Extremely fast editing
  • Awesome plugin community

Things to Know

  • Available in a terminal window
  • No mouse!

Learning Curve

Title Text

Getting to Know Vim

Editing and Moving are Separate

Normal Mode

  • Movement allowed
  • Execute Vim commands
  • Move quickly around the file
  • Other modes return to here

Insert Mode

  • Movement (sort of) allowed
  • Most similar to editors that you're familiar with
  • Form "Normal" mode, press "i" to enter insert mode

Movement

// Basic motion

h : move right
l : move left
j : move down
k : move up


// Jumping

w  : beginning of next word
e  : end of next word
b  : beginning of previous word
ge : end of previous word
%  : jump to matching symbol


// Moving Faster

2h : move 2 characters right
4w : move to the front of the 4th word
  • Arrow keys work, but don't use them
  • By default, move one "step" at a time
  • Can be combined with numbers to repeat movements

Basic Commands

// Quitting Vim

:q   : quit
:qa  : quit all
:qa! : force quit all


// Save a File

:w   : save
:wq  : save and quit


// Other stuff

:help __command_name__
  • Vim commands usually start with a colon
  • Toggle features on and off

Vim Features

What sets Vim apart?

Panes

Marks

  • Place a "bookmark" at a particular place of a file
  • Easy shortcut to jump back to that particular spot
  • Separate set of system-wide marks

Plugins

  • Most people use many plugins with Vim
  • Syntax highlighting
  • Automatic linting
  • Autocomplete
  • Project management
  • Fuzzy finder

Now it's your turn!

ssh _pitt_username@unixs.cis.pitt.edu

1. SSH Into Server

2. Visit File

http://cl.ly/a4ND

Other Options

  • http://www.openvim.com
  • http://vim-adventures.com/

More Resources

Vim Awesome - http://vimawesome.com

  • Excellent resource for finding Vim plugins

Tim Pope

  • The king of Vim plugins, all of his are great

ThoughtBot Dotfiles

  • https://github.com/thoughtbot/dotfiles/blob/master/vimrc
  • Excellent starting point for your own Vim config

My Dotfiles

  • https://github.com/alexlafroscia/dotfiles/blob/master/vim/vimrc

Vim

By Alex LaFroscia

Loading comments...

More from Alex LaFroscia