sponsor Vim development Vim logo Vim Book Ad

Find XML Tags : Locate tags with out of order attributes

 script karma  Rating 1/1, Downloaded by 1093  Comments, bugs, improvements  Vim wiki

created by
Salman Halim
script type
I was editing an HTML file written by several developers over the course of a
few years. They contained tags like (yes, literally!)
        <table cellpadding=0 cellspacing="0" border='0'>
        <table cellspacing="0" cellpadding=0 border='0'>
        <table cellspacing=0 cellpadding=0 border=0>

They're all basically the same table definition, but the attributes are
switched around and the attribute values are formatted differently each time.
(Thank the multiple developers, each with their own style.) Running HTML Tidy
wasn't an option because I didn't want to create a huge diff in version
control that indicated a lot of changes where I didn't actually change
anything. Thus, this plugin.

The commands and functions defined in this script will match any XML/HTML
element/tag with the specified attributes and values.
install details
Source the Vimball and try :help Findxmltag.

Use :help FindXmlTag_History to find out what's changed.

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
FindXmlTag.vba 2.0 2011-05-24 7.3 Salman Halim Bug fixes, mostly (thanks entirely to Ingo Karkat). Also, renamed the commands to camel-case: FindXmlTagExact and FindXmlTagFlexible.

Uploaded again; had accidentally left out an enhancement to highlight search results if 'hlsearch' is set.
FindXmlTag.vba 1.5 2011-05-17 7.3 Salman Halim Added options to easily add attributes with any value or no value.
FindXmlTag.vba 1.0 2011-05-17 7.3 Salman Halim 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.
Vim at Github