This is a set of search and replaces that usually allow you to find an unclosed tag that is wrecking hell on your html (uggg ad code and customizable html snippets are the bane of my existence)
I usually grab the most likely html snippet using web developer -> view source -> view generated source
#setup
set filetype=xml
filetype indent on
% s:\n::g #remove linebreaks
% s:\s\+: :gi #trim multiple spaces to a single space (not really needed but nice...)
# common tags that don't need to be closed
% s:<br.\{-}>::gci #manually look through and remove
tags
% s:<img.\{-}>::gci #manually remove image tags
# check and remove a few tags that can contain some funky chars
% s:<!--.\{-}-->::gci #manually look through and remove comment blocks
% s:<script.\{-}>.\{-}</script>::gci #manually look through and remove script blocks
% s:<style.\{-}>.\{-}</style>::gci #manually look through and remove style blocks
# at this point you are left with tags that need to be closed
# ymmv... this just hits the common stuff that I usually have to dig through
% s:<:\r<:gi #add a linefeed before every tag
then press gg+G to re-indent the entire file.
Note: Use the 'c' (confirm) option in most searches. You would be amazed at the crazy things that comes through in ad code and user customizable html.
:)