Here's what I would do. Visually select all of your HTML you want to do this to, and hit the following:
:norm f=i<space><C-v><esc>la<space>
Note that <C-v>
, <esc>
, and <space>
are keystrokes, not literal text.
Explanation:
:norm
Means apply the following set of keystrokes to every selected line. f=
means move to the first equals sign. This conveniently has the added benefit of stopping playback if an =
character is not found. i<space><C-v><esc>
means enter insert mode, insert a space, and then esc. <C-v>
allows us to enter a literal esc character, which is necessary since we are doing this from the command line. la<space>
moves one to the right (so we are on top of the equals sign), and appends a space after the equals sign.
The only downside to this approach is that you must manually select every section of HTML to do this to, which is necessary if you do not want to use a regex search and replace.
=
for HTML is bad form, IMO. It makes HTML less readable.%s/=\+/ \0 /g
that wouldn't be a problem.