Quote unquoted HTML attributes
From Vim Tips Wiki
Tip 662 Previous Next Created: February 25, 2004 Complexity: basic Author: James Childers Version: 5.7
This is a simple regex that can be used to search an HTML file and replace all unquoted attributes with their quoted version.
map <F9> :%s/\([^&^?]\)\(\<[[:alnum:]-]\{-}\)=\([[:alnum:]-#%]\+\)/\1\2="\3"/g<CR>
[edit] Comments
I use this regex and abbreviate it to "reg1".
cabbrev reg1 %s/=\([^"][^> ]\{0,40\}\)/="\1"/gc
