gregsexton / MatchTag

Vim's MatchParen for HTML tags
http://www.vim.org/scripts/script.php?script_id=3818
311 stars 30 forks source link

Highlight unclosed tags with Error group #1

Closed kien closed 13 years ago

kien commented 13 years ago

Hi,

A small addition. This also changes the stopline to 0.

Please review and pull if you like.

Thanks!

gregsexton commented 13 years ago

Hi Kien,

Correct me if I'm wrong but this achieves two things.

  1. Highlighting the tag the cursor is in even if the matching tag is off-screen.
  2. Highlighting a tag that does not have a closing tag (e.g img).

Both of which can be achieved by removing lines 72-75. Admittedly, I think this will match anything between '<' and '>' regardless of whether it is a vaild html tag.

If this functionality is popular I will consider adding it and taking the suggestions from this pull request into consideration.

Please let me know if I've missed anything.

Thanks,

Greg

kien commented 13 years ago
  1. Yup.
  2. Actually, it doesn't highlight tags like img, the s:selfclosing is to not treat them as unclosed tags.
  3. Highlighting of unclosed tags means it highlights <div> that doesn't have a matching </div> or vice versa, with the Error highlight group.
  4. Move the 'htmlString\|htmlComment\|htmlCommentPart' identifying part to earlier.
gregsexton commented 13 years ago

Thanks for clarifying. I'll take a good look at merging some of this.

kien commented 13 years ago

Just made a lot of small changes so I think I'll keep this version for my own use instead. Thanks again for the great plugin!

https://gist.github.com/1386336