Vi commands: Difference between revisions

From Objectif Client Inc
Jump to navigation Jump to search
Line 1: Line 1:
==Manipulation==
==Manipulation==
===Search and Replace===
===Search and Replace===
====One-by-One===
====First One on the line====
<pre>:s/OLD/NEW</pre>
<pre>:s/OLD/NEW</pre>
====All occurences of the line====
<pre>:s/OLD/NEW/g</pre>
====Replace All (Globally)====
====Replace All (Globally)====
<pre>:%s/OLD/NEW/g</pre>
<pre>:%s/OLD/NEW/g</pre>

Revision as of 23:42, 31 October 2014

Manipulation

Search and Replace

First One on the line

:s/OLD/NEW

All occurences of the line

:s/OLD/NEW/g

Replace All (Globally)

:%s/OLD/NEW/g

Display Command

Display line Number

Press :

 set number or set nonumber