sponsor Vim development Vim logo go to HTTPS page Vim Book Ad

xhtml.vim : XHTML syntax highlighting

 script karma  Rating 228/67, Downloaded by 3722    Comments, bugs, improvements  Vim wiki

created by
Michał Górny
script type
Syntax highlighting for Extensible HyperText Markup Language.
Handles XHTML 1.0 (Strict, Transitional and Frameset) and XHTML 1.1;
XHTML 2.0 (as of 7th Working Draft), including XML Events and XForms, is also highlighted.

Syntax of the following languages embedded in XHTML document can be highlighted: MathML, SVG, CSS, JavaScript, VBScript, SSI and XSSI.

There is also special highlighting for XHTML events ("on..." attributes with JavaScript content), however it is possible to disable it by setting the following variable:
(just insert line "let xhtml_no_events_rendering=1" to your .vimrc file).

CSS highlighting in "style" attributes is availaible too; you can disable it by setting this variable:
install details
Requires mathml.vim (vimscript #1235) and svg.vim (vimscript #935) (for version 1.0.1+ you need mathml.vim v. 1.0.1+ and svg.vim v. 1.1.1+).
However, you can choose not to use MathML and SVG syntax files – in that case you will have to set the following variables in your .vimrc:

Drop xhtml.vim into your syntax directory. You should also disable (e.g. rename or delete) XHTML syntax file that comes with distribution, to avoid unnecessary sourcing of HTML syntax file.

Probably you have got already appropriate entry in filetype.vim (for *.html, *.htm, *.shtml and *.stm files), but it's good idea to add also *.xhtml and *.xht files recognizing:
    au BufNewFile,BufRead *.xhtml,*.xht setf xhtml

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
xhtml.vim 1.2 2006-03-23 6.0 Michał Górny Added xml-stylesheet processing instruction attributes
xhtml.vim 1.1 2005-06-22 6.0 Michał Górny XHTML 2.0 updated to 7th Working Draft; some other minor changes
xhtml.vim 1.0.3 2005-06-07 6.0 Michał Górny Fixed XML declaration attribs highlighting
xhtml.vim 1.0.2 2005-04-15 6.0 Michał Górny Corrected XHTML2-style links rendering on h1-h6 elements
xhtml.vim 1.0.1 2005-04-11 6.0 Michał Górny Few small corrections
xhtml.vim 1.0 2005-03-11 6.0 Michał Górny Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
SourceForge.net Logo