Vi

From Linuxintro
Revision as of 08:36, 19 February 2010 by imported>ThorstenStaerk
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

replace

:1,%s/old text/new text/g

1 -> first line

$ -> last line

s -> replace

you cannot use wildcards (*,?) for the text to be replaced, but you can use e.g. [0-9]

concatenate lines

Press J, it concatenates the actual and the next line.

repeat last action

In the order mode, press ..

block-based actions

u undoes the last action

  1. CTRL_v and mark lines in the block mode
  2. CTRL_i insert the wished items
  3. ESC