Skip to content

Instantly share code, notes, and snippets.

@emilisto
Last active December 11, 2015 19:28
Show Gist options
  • Save emilisto/4648289 to your computer and use it in GitHub Desktop.
Save emilisto/4648289 to your computer and use it in GitHub Desktop.
Short guide I wrote up for some friends

Emil's short guide to vim

There are two modes in vim:

  1. Command mode – you can't write stuff, keys are interpreted as commands.
  2. Insert mode - it acts like a normal editor, you know you're in insert mode because it says "INSERT" at the bottom.

The most important ones

  • a – enter insert mode from command mode
  • ESCAPE – enter command mode from insert mode
  • :w - save
  • :wq – quit and save
  • dd – delete the whole line
  • / – search for something
  • :e <filename> – open new file

The ones you will want, but don't need

  • :split and :vsplit - split your screen in two
  • CTRL-w <arrow> – change split pane, e.g. CTRL-w-RIGHT will go to one pane to the right.
  • } and { – move cursor one paragraph up or down respectively

The more exotic ones

  • vip – highlight the current paragraph
  • vi{ – highlight everything within the { ... }
  • dip – delete the current paragraph
  • di{ – delete everything within the { ... }
  • ciw – change the current word
  • o – start writing a new line after the current line

See the logic with the vip, dip, ciw?

Disclaimer

These were the commands that I got from the top of my head, based on what I usually use. If you think there's something else, that a beginner absolutely has to know to be seduced by vim, fork and add!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment