Skip to content

ENH: Support tags that span multiple lines. #18

Merged
merged 2 commits into from May 4, 2013

2 participants

@inkarkat

Some code styles spread tags that have many attributes over multiple lines, e.g.

<foo bar="1"
     baz="2">

This patch extends the highlighting to those tags. In s:GetCurrentCursorTag(), when the current line does not contain a full tag, as a fallback the start of a tag is accepted. (It does not verify that the tag is actually properly closed in following lines.)
In s:SearchForMatchingTag(), the patterns are modified to also match newlines (while ensuring that when searching for the start tag, the current end tag is not accidentally matched). (The patterns already include the fix for subset tag names from bc576b5.)

@gregsexton gregsexton commented on an outdated diff Apr 27, 2013
ftplugin/html.vim
@@ -40,8 +40,14 @@ fu! s:GetCurrentCursorTag()
let c_col = col('.')
let matched = matchstr(getline('.'), '\(<[^<>]*\%'.c_col.'c.\{-}>\)\|\(\%'.c_col.'c<.\{-}>\)')
- if matched == "" || matched =~ '/>$'
- return ""
+ if matched =~ '/>$'
+ return ""
@gregsexton
Owner
gregsexton added a note Apr 27, 2013

This looks like a tab rather than spaces. Can you fix the indentation here please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@gregsexton
Owner

Please fix the indentation and then I'll be happy to merge this in. Thanks for your work on this.

inkarkat added some commits Apr 16, 2013
@inkarkat inkarkat ENH: Support tags that span multiple lines.
Some code styles spread tags that have many attributes over multiple lines, e.g.
<foo bar="1"
     baz="2">

This patch extends the highlighting to those tags. In s:GetCurrentCursorTag(), when the current line does not contain a full tag, as a fallback the start of a tag is accepted. (It does not verify that the tag is actually properly closed in following lines.)
In s:SearchForMatchingTag(), the patterns are modified to also match newlines (while ensuring that when searching for the start tag, the current end tag is not accidentally matched). (The patterns already include the fix for subset tag names from bc576b5.)
5915d73
@inkarkat inkarkat Add modeline for preferred indentation and correct wrong indents. 591ecc2
@inkarkat

Ah sorry about that. I've pushed a corrected commit and added a modeline + correction for the few original lines (not from my patches) where the indents were off.

@gregsexton gregsexton merged commit 591ecc2 into gregsexton:master May 4, 2013
@gregsexton
Owner

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.