VimCommands

From PsirainWiki

Jump to: navigation, search

Search for characters not in a set (e.g. not A-Z, ., , 0-9)

/[^A-Z.[0-9]]

Find instances of the string "abc" not followed by the string "def"

/abc\(def\)\@!

Case Insensitive searching

/string\c

Macros

 Start recording:  q[0-9a-zA-Z"]
 Stop recording:  q
 Playback:  @[0-9a-zA-Z".=*]

Tabs (convert all tabs in the current file to their proper space allotment)

 :retab

Folding

 create:  <visual> zf
 open:  za
 close:  zc
 delete:  zd

Split vertically

 <ctrl-w> v

Diff

 open file to diff
 :diffsplit <file to diff with> (horizontal)
 Or select both files, right-click and choose 'diff with vim" (vertical)
 To diff horizontally from the command-line 'diff -od file1 file2'

Print

 :hardcopy
 <range> :hardcopy

Commands on multiple files

 :windo
 :argdo

Pipe function output directly into an editor window

 [command] | gvim -