Web-Markup-VimTips

From KRayWiki
Jump to navigation Jump to search

Editing FAQ

How do I change unquoted attribute values to quoted values?

  • This colon command changes unquoted numeric attribute values to quoted values
    g/./s/=\([0-9]*\)\([ >]\)/="\1"\2/g

How do I switch HTML or XHTML tag and attribute names to lowercase?

  • Use the following colon commands in a vim editor after making sure that all attribute values are quoted. Attributes without quotes are not modified.
    • Entities
      %s/<\/\?\zs\(\w\+\)\ze[ >]/\L\1/g
    • Attributes
      %s/\(<[^>]*\)\@<=\<\(\a*\)\ze=['"]/\L\2/g

Where can I find lists of character entities?