diff options
author | Bram Moolenaar <Bram@vim.org> | 2006-02-01 21:47:16 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2006-02-01 21:47:16 +0000 |
commit | b8a7b560b1c25a059dfb57cbe40f0a3f98ed8e97 (patch) | |
tree | 090b45a23993b236f0a8c18fd2297f3142194066 /runtime/autoload | |
parent | 280f126ef03c4e7d71d2c8341d661d3e37157851 (diff) | |
download | vim-b8a7b560b1c25a059dfb57cbe40f0a3f98ed8e97.zip |
updated for version 7.0191
Diffstat (limited to 'runtime/autoload')
-rw-r--r-- | runtime/autoload/htmlcomplete.vim | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/runtime/autoload/htmlcomplete.vim b/runtime/autoload/htmlcomplete.vim index c7a43c304..cf76e69cc 100644 --- a/runtime/autoload/htmlcomplete.vim +++ b/runtime/autoload/htmlcomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: XHTML 1.0 Strict " Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) -" Last Change: 2006 Jan 24 +" Last Change: 2006 Jan 30 function! htmlcomplete#CompleteTags(findstart, base) if a:findstart @@ -29,7 +29,19 @@ function! htmlcomplete#CompleteTags(findstart, base) endwhile endif endif - if !exists("b:csscompl") + let scriptstart = searchpair('<script\>', '', '<\/script\>', "bnW") + let scriptend = searchpair('<script\>', '', '<\/script\>', "nW") + if scriptstart != 0 && scriptend != 0 + if scriptstart <= curline && scriptend >= curline + let start = col('.') - 1 + let b:jscompl = 1 + let b:jsrange = [scriptstart, scriptend] + while start >= 0 && line[start - 1] =~ '\(\k\|-\)' + let start -= 1 + endwhile + endif + endif + if !exists("b:csscompl") && !exists("b:jscompl") let b:compl_context = getline('.')[0:(compl_begin)] if b:compl_context !~ '<[^>]*$' " Look like we may have broken tag. Check previous lines. Up to @@ -68,6 +80,10 @@ function! htmlcomplete#CompleteTags(findstart, base) unlet! b:csscompl let context = b:compl_context return csscomplete#CompleteCSS(0, context) + elseif exists("b:jscompl") + unlet! b:jscompl + let context = b:compl_context + return javascriptcomplete#CompleteJS(0, context) else if len(b:compl_context) == 0 && !exists("b:entitiescompl") return [] @@ -111,6 +127,9 @@ function! htmlcomplete#CompleteTags(findstart, base) " should abandon action - with one exception: <style> span { bo if context =~ 'style[^>]\{-}>[^<]\{-}$' return csscomplete#CompleteCSS(0, context) + elseif context =~ 'script[^>]\{-}>[^<]\{-}$' + let b:jsrange = [line('.'), search('<\/script\>', 'nW')] + return javascriptcomplete#CompleteJS(0, context) else return [] endif |