Skip to content

Instantly share code, notes, and snippets.

View glass-ships's full-sized avatar

Glass glass-ships

View GitHub Profile
<h2>VIM Search and replace syntax</h2>
<p>The syntax is as follows:<br />
<code>:%s/Search/Replace/CommandFlag<br />
:%s/Search-Word/Replace-Word/g<br />
:%s/Search-Word/Replace-Word/g<br />
:%s/Search-Word/Replace-Word/gc<br />
<span style="color: #999999;">## Search and replace in<span style="color: #009900;"> the current line only</span> ##</span><br />
:s/Find-Word/Replace-Word/g<br />
<span style="color: #999999;">## Change each 'Unix' to 'Linux'<span style="color: #009900;"> for all lines from line 36 to line 42</span> ##</span><br />
:36,42s/Unix/Linux/g<br />