Graphics.VimXMLHowto - lordmundi/wikidoctest GitHub Wiki

Vim XML Howto

Intro

Make vim XML-smart.

Download

Install

% cd ~/.vim
 % mkdir doc
 % mkdir ftplugin ;    # ft stands for "file type"
 % mv [xml.vim][1] ftplugin
 % unzip [matchit.zip][3]

Configure

% vi ~/.vimrc
 Add to bottom of file:
 " XML, HTML folding and tag match
 " Help :help xml-plugin
 source ~/.vim/plugin/matchit.vim
 au BufNewFile,BufRead *.xml     source ~/.vim/ftplugin/xml.vim
 au BufNewFile,BufRead *.html    source ~/.vim/ftplugin/xml.vim

Init

% vi dog.xml
 "dog.xml" 8L, 63C
 xml-plugin v1.35: Help-documentation installed.

Help

While in vi-ing an HTML/XML doc, try:
 : help xml-plugin

Favorites

\f    # Folds a block
 %     # Matches tags
 \f dd # Deletes a block
 \I    # Indent html/xml on tags, if it hangs control-c