# HG changeset patch # User vimboss # Date 1138830436 0 # Node ID 8157079cea85b5eacb529c88f38d42fa69b74f0f # Parent 9032e466829601e6c56046813d0a9a00946a1d10 updated for version 7.0191 diff --git a/runtime/autoload/htmlcomplete.vim b/runtime/autoload/htmlcomplete.vim --- 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(find endwhile endif endif - if !exists("b:csscompl") + let scriptstart = searchpair('', '', '<\/script\>', "bnW") + let scriptend = searchpair('', '', '<\/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(find 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(find " should abandon action - with one exception: