1
0
mirror of https://github.com/gryf/.vim.git synced 2025-12-18 12:00:30 +01:00

Update matchtag plugin and python syntax

This commit is contained in:
2013-03-11 21:49:51 +01:00
parent 6f15bec6df
commit a8f1365f18
4 changed files with 399 additions and 234 deletions

View File

@@ -40,8 +40,8 @@ fu! s:GetCurrentCursorTag()
let c_col = col('.')
let matched = matchstr(getline('.'), '\(<[^<>]*\%'.c_col.'c.\{-}>\)\|\(\%'.c_col.'c<.\{-}>\)')
if matched == ""
return matched
if matched == "" || matched =~ '/>$'
return ""
endif
let tagname = matchstr(matched, '<\zs.\{-}\ze[ >]')
@@ -51,9 +51,9 @@ endfu
fu! s:SearchForMatchingTag(tagname, forwards)
"returns the position of a matching tag or [0 0]
let starttag = '<'.a:tagname.'.\{-}>'
let starttag = '<'.a:tagname.'.\{-}/\@<!>'
let midtag = ''
let endtag = '</'.a:tagname.'.\{-}>'.(a:forwards?'':'\zs')
let endtag = '</'.a:tagname.'.\{-}'.(a:forwards?'':'\zs').'>'
let flags = 'nW'.(a:forwards?'':'b')
" When not in a string or comment ignore matches inside them.
@@ -65,7 +65,12 @@ fu! s:SearchForMatchingTag(tagname, forwards)
let stopline = a:forwards ? line('w$') : line('w0')
let timeout = 300
return searchpairpos(starttag, midtag, endtag, flags, skip, stopline, timeout)
" The searchpairpos() timeout parameter was added in 7.2
if v:version >= 702
return searchpairpos(starttag, midtag, endtag, flags, skip, stopline, timeout)
else
return searchpairpos(starttag, midtag, endtag, flags, skip, stopline)
endif
endfu
fu! s:HighlightTagAtPosition(position)

View File

@@ -0,0 +1,2 @@
runtime! ftplugin/html.vim