Vim Tips Wiki

Editing

Search and replace

1
  • The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit. If you are undoing an edit that is …
Latest revision Your text
Line 51: Line 51:
 
|style="vertical-align:top" |<code>:s/foo/bar/g</code> || Change each 'foo' to 'bar' in the current line.
 
|style="vertical-align:top" |<code>:s/foo/bar/g</code> || Change each 'foo' to 'bar' in the current line.
 
|-
 
|-
|style="vertical-align:top" |<code>:%s/foo/bar/g</code> || Change each 'foo' to 'bar' in all the lines.
+
|style="vertical-align:top" |<code>:%s/foo/bar/g</code> || Change each 'foo' to 'bar' in all lines.
 
|-
 
|-
|style="vertical-align:top" |<code>:5,12s/foo/bar/g</code> || Change each 'foo' to 'bar' for all lines from line 5 to line 12 (inclusive).
+
|style="vertical-align:top" |<code>:5,12s/foo/bar/g</code> || Change each 'foo' to 'bar' for all lines from line 5 to line 12 inclusive.
 
|-
 
|-
 
|style="vertical-align:top" |<code>:'a,'bs/foo/bar/g</code> || Change each 'foo' to 'bar' for all lines from mark a to mark b inclusive (see '''Note''' below).
 
|style="vertical-align:top" |<code>:'a,'bs/foo/bar/g</code> || Change each 'foo' to 'bar' for all lines from mark a to mark b inclusive (see '''Note''' below).
  Loading editor
Below are some commonly used wiki markup codes. Simply click on what you want to use and it will appear in the edit box above.

View this template