Vi commands: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==Manipulation== | ==Manipulation== | ||
===Search and Replace=== | ===Search and Replace=== | ||
====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 == | ||
=== Display line Number === | === Display line Number === | ||
<p>Press :</p> | <p>Press :</p> | ||
<pre> set number or set nonumber </pre> | <pre> set number or set nonumber </pre> |
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