Vi commands: Difference between revisions

From Objectif Client Inc
Jump to navigation Jump to search
No edit summary
 
(One intermediate revision by the same user not shown)
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>


== Display Command ==
== Display Command ==

Latest revision as of 20:09, 11 December 2016

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