sponsor Vim development Vim logo Vim Book Ad

xml.vim : helps editing xml (and [x]html, sgml, xslt) files

 script karma  Rating 360/147, Downloaded by 19112    Comments, bugs, improvements  Vim wiki

created by
Rene de Zwart
 
script type
ftplugin
 
description
A plugin for editing xml. I used xml.vim (http://www.vim.org/scripts/script.php?script_id=301)
The script does retain most of the functionality of the original xml.vim
- closing tags while you type
- optional adding attributes
- and more
- % matches end or begin tag
it adds:
- fold tags, comments and Cdata
- add start tag
- add end tags
- add  tag around a visual blok or a tag,
- join 2 adjacent same tags
- delete tag
- delete tag section
- change a tag
- visual mode  (blocks, listitems
The documentation will be created once the script is loaded e.g edit a xml file.
Read the help documentation by typing from within vim  :help xml-plugin

The latest version is now available from https://github.com/othree/xml.vim.
 
install details
copy xml.vim to  ~/.vim/ftplugin/xml.vim)
optionally link (or copy on windows) xml.vim in ~/.vim/ftplugin directory to docbk.vim, xsl.vim, html.vim, xhtml.vim
when you have filetype indent on. Then create a ~/.vim/indent directory and for every link (copy) you made do
      echo "let b:did_indent = 1" > ~/.vim/indent/xml.vim
Because standard vimXX/indent/xml.vim interferes with xml.vim
 

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
xml.vim 1.40 2011-07-14 6.0 Rene de Zwart Same version but this patch is from bootleg. Thanks
xml.vim 1.40 2011-07-13 7.0 Rene de Zwart O3 supplied this patch (again) thanks
xml.vim 1.39 2010-10-11 6.0 Rene de Zwart An other patch from O3. Make sure that buffer variable did_indent exists
xml.vim 1.38 2010-10-08 6.0 Rene de Zwart Othree send me the patch for:
update the empty tag list and fix a bug
while using other indent plugin will make double indent.
xml.vim 1.37 2009-11-12 7.0 Rene de Zwart 1) document directory create a wrong directory under windows when the path contained a space. thanks to Guande Wang.
2) filetype indent interferes with xml.vim thanks to Brandon Waskiewicz
3) exe normal changed to exe normal! to avoid key remappings thanks to Roald de Vries
xml.vim 1.36 2009-09-21 6.0 Rene de Zwart xml-plugin-callbacks is defined twice by "Samuel Ferencik"
CloseTag definiton had optional attribute
xml.vim 1.35 2007-03-17 6.0 Rene de Zwart 1.35 Neil walker send a patch to change to cursor positioning to use (suprise) cursor function
        Thanks Neil
1.34 Had a variable CloseTag and a function CloseTag
xml.vim 1.33 2006-07-02 6.0 Rene de Zwart Ian A. Tegebo noticed that match and fold didn't when a tag has an attribute like
<tag att="dc=rescomp,dc=berkeley,dc=edu">. The regular expresssion s:Attrib
didn't work in that situation
xml.vim 1.32 2006-05-12 6.0 Rene de Zwart improvements from Guangde Wang (g2wang at yahoo com)
check for jsp tags, php tags and 0 length tagnames
Thanks Guangde
(and please do send  improvements if anyone stumbles over them)
xml.vim 1.30 2006-04-12 6.0 Rene de Zwart added function
    DelCData ( \[ )     deletes Cdata tag
    DelCDataSection (\{) deletes cdata section
    DelComment (\])    deletes comment tag
    DelCommentSection (\})  delete comment section
    commenttag (\=)       puts a comment around the tag
changed All suffix to Section as a better understaning
updated the documentation (volunteers for a better effort are welcome ;-)
added menu entries
Correct  typo in menu (Your welcome to point out more)
Check  more strict to not match comments as closing tag
xml.vim 1.28 2005-12-08 6.0 Rene de Zwart - Code Changes
    - regular expressions moved to script variables which document them a bit
    - rename b:endtag to b:firstWasEndTag as a better description.
    -while loops level check into while
    - level in/de-crease using ? operator
- Moved a bit of the global xml script into xml
- added [ and ] mappings for next/previous open/close tag/comment
- distribute dtdmenu seperatly since it is only a bit related to xml.vim
- add \5 \% visual mode which extends the visual selection to the matching tag
- made \l cursor position end up after the closing </listitem> easier marking up by hand
-updated the documentation
xml-dtd.zip 1.27 2005-11-30 6.0 Rene de Zwart - Added listitem \l for marking up (itemized|ordered)list in docbook
- added \I (capital i) indent all function  (does maybe more then one expect)
- added \<  to comment out a block  
- added \c to comment out a block with CDATA Section
- convinience menu entry gvim fold cdata section  (just a simple :?<![CDATA[,/]]>/fold)
- convinience menu entry gvim fold comment section (just a simple :?<!--?,/-->/fold)
- documentation updated
xml.vim 1.16 2005-11-16 6.0 Rene de Zwart - Error in MakeElement in (x)html mode the cursor postion after emptytags was wrong
- foldTag added the case when started from closetag (backward range)
- foldTagAll do everything in the function not calling FoldTag.
- Added the <silent> option to the remaps
- FormatTagAll  do everything in the function not call FormatTag
- Function ShiftRight and ShiftLeft
- Updated the docs
xml.vim 1.11 2005-11-14 6.0 Rene de Zwart added function makeElement thanks to Bart van Deenen script make-element.vim (632)
typing word;; expands into <word></word>. ;; is customisable see doc
documentation update
html_mode mode detection error
made xml_use_xhtml a buffer variable set by g:xml_use_xhtml
in it's absence by the fact that we are editing a xhtml filetype
xml.vim 1.9 2005-11-14 6.0 Rene de Zwart documentation update
new function FormatTagAll will format all tagnames like the one the cursor is on
error in BlockTag when visual selection is one line only
after FoldTagAll, AfterTag, BeforeTag,FormatTagAll return to where the command was given from
xml.vim 1.6 2005-11-14 6.0 Rene de Zwart More compatability with devins xml.  (HtmlAttribCallback && XmlAttribCallback. xml_use_xhtml
support for open html tags in html mode and xml mode makes them empty tags)
Documentation updated
ask for attributes
reuse the last given tag and attributes when prompting
visual block now uses append for top and bottom
removed the use unmapgt & mapgt in favor of normal!
xml.vim 1.2 2005-11-10 6.0 Rene de Zwart Initial upload
ip used for rating: 54.197.94.141

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