Vim

From WikiPaul - Paul Swanson's wiki

Jump to: navigation, search

Basic Vim

There are two modes - Command mode and Insert mode. Vim starts in command mode; that is, you can type commands. To type text, press i for insert. You can then type as in a normal text editor. To exit insert mode, press esc.

Useful commands

Save/write  :w
Quit  :q
Save and exit  :wq
Search down /search
Search up  ?search
Next search term n
Search for word under cursor *
Search/replace  :s/search/replace/
Global search/replace  :%s/search/replace/g
Undo u
Jump to line number  :linenumber

Copy/paste

  1. Press v to enter text-selection mode
  2. Arrow to the end of where you want to copy/cut/paste (you can do searches and whatnot here)
  3. Press y to copy or c to cut
  4. To paste, press p
  1. Press yy to copy an entire line
  2. p to paste