This is not exhaustive or anything, just a memo.The simple of it:
's' means substitute. While it may also mean "search", the search command is usually a slash
/, as in
The slash separates the command, the searchable item, the replaceable item, and additional parameters.
To replace stuff throughout the whole file (or document), use the percent
This replaces commas across one (long or large) line with a newline (carriage return). Breakdown:
s/— starts the substitute command
after slash, enter search string
\&— all occurrences of desired search string within a line
,— comma is what one is looking for
/— the next slash separates the search string from the replacement
^M— newline (carriage return). in gVIM (for Windows), it's highlighted, as it's actually entered as
/g— replace till the end of line. Useful for if there's a huge amount of text in one line.
If one wants carriage returns after a comma, use this:
— where the usually coloured (and special) carriage return symbol
^Mfollows the ampersand
&. The ampersand is used to to add text: stuff before it is added before the searchable string; stuff added after the ampersand means that instead of deleting, stuff is added after the searchable string.
Here it replaces all
"with normal quote characters
\&— all occurrences of search string within a line;
"\;note that the semicolon is escaped.
\&— search in a line all instances of
&\t— As stated above, the ampersand & is used to add stuff; in this instance, a tab
\tis added after the searchable string.
Turn highlight off
^ Given that all searchable strings found are highlighted. But then it turns annoying when going to edit text after things are done. Instructions from the Vim wikia.