diff options
author | Bram Moolenaar <Bram@vim.org> | 2006-01-25 22:02:51 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2006-01-25 22:02:51 +0000 |
commit | 28c258fd24342fe52e85059d68ce69cf9ef5f8cd (patch) | |
tree | 6f8dc9ce77b063c0498f1ca554464395fb995666 /runtime/autoload/htmlcomplete.vim | |
parent | 7df351eb8aecf8e542c7ebecc4ec734107a8aacb (diff) | |
download | vim-28c258fd24342fe52e85059d68ce69cf9ef5f8cd.zip |
updated for version 7.0187
Diffstat (limited to 'runtime/autoload/htmlcomplete.vim')
-rw-r--r-- | runtime/autoload/htmlcomplete.vim | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/runtime/autoload/htmlcomplete.vim b/runtime/autoload/htmlcomplete.vim index 768afd572..c7a43c304 100644 --- a/runtime/autoload/htmlcomplete.vim +++ b/runtime/autoload/htmlcomplete.vim @@ -1,13 +1,14 @@ " Vim completion script " Language: XHTML 1.0 Strict " Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) -" Last Change: 2006 Jan 22 +" Last Change: 2006 Jan 24 function! htmlcomplete#CompleteTags(findstart, base) if a:findstart " locate the start of the word let line = getline('.') let start = col('.') - 1 + let curline = line('.') let compl_begin = col('.') - 2 while start >= 0 && line[start - 1] =~ '\(\k\|[:.-]\)' let start -= 1 @@ -20,8 +21,7 @@ function! htmlcomplete#CompleteTags(findstart, base) let stylestart = searchpair('<style\>', '', '<\/style\>', "bnW") let styleend = searchpair('<style\>', '', '<\/style\>', "nW") if stylestart != 0 && styleend != 0 - let curpos = line('.') - if stylestart <= curpos && styleend >= curpos + if stylestart <= curline && styleend >= curline let start = col('.') - 1 let b:csscompl = 1 while start >= 0 && line[start - 1] =~ '\(\k\|-\)' @@ -31,6 +31,27 @@ function! htmlcomplete#CompleteTags(findstart, base) endif if !exists("b:csscompl") let b:compl_context = getline('.')[0:(compl_begin)] + if b:compl_context !~ '<[^>]*$' + " Look like we may have broken tag. Check previous lines. Up to + " 10? + let i = 1 + while 1 + let context_line = getline(curline-i) + if context_line =~ '<[^>]*$' + " Yep, this is this line + let context_lines = getline(curline-i, curline) + let b:compl_context = join(context_lines, ' ') + break + elseif context_line =~ '>[^<]*$' + " Normal tag line, no need for completion at all + let b:compl_context = '' + break + endif + let i += 1 + endwhile + " Make sure we don't have counter + unlet! i + endif let b:compl_context = matchstr(b:compl_context, '.*\zs<.*') else let b:compl_context = getline('.')[0:compl_begin] @@ -94,7 +115,6 @@ function! htmlcomplete#CompleteTags(findstart, base) return [] endif endif - "if context !~ '<$' " Set attribute groups let coreattrs = ["id", "class", "style", "title"] |