Difference between revisions of "Vi"

From Linuxintro
imported>ThorstenStaerk
(New page: = block-based actions = u undoes the last action 1. <strg><v> und im Blockmodus die Zeilen markieren 2. <shift><i> das gewuenschte einfuegen 3. <ESC>)
 
imported>ThorstenStaerk
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 +
= 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 =
 
= block-based actions =
 
u undoes the last action
 
u undoes the last action
1. <strg><v> und im Blockmodus die Zeilen markieren
+
# CTRL_v and mark lines in the block mode
2. <shift><i> das gewuenschte einfuegen
+
# CTRL_i insert the wished items
3. <ESC>
+
# ESC

Latest revision as of 08:36, 19 February 2010

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