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:
@@ -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)
|
||||
|
||||
2
bundle/ft_matchtag/ftplugin/xml.vim
Normal file
2
bundle/ft_matchtag/ftplugin/xml.vim
Normal file
@@ -0,0 +1,2 @@
|
||||
runtime! ftplugin/html.vim
|
||||
|
||||
Reference in New Issue
Block a user