" Vim completion script " Language: XHTML 1.0 Strict " Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) " Last Change: 2005 Now 20 function! htmlcomplete#CompleteTags(findstart, base) if a:findstart " locate the start of the word let line = getline('.') let start = col('.') - 1 let compl_begin = col('.') - 2 while start >= 0 && line[start - 1] =~ '\(\k\|[:.-]\)' let start -= 1 endwhile if start >= 0 && line[start - 1] =~ '&' let b:entitiescompl = 1 let b:compl_context = '' return start endif let stylestart = searchpair('', '', '<\/style\>', "bnW") let styleend = searchpair('', '', '<\/style\>', "nW") if stylestart != 0 && styleend != 0 let curpos = line('.') if stylestart <= curpos && styleend >= curpos let start = col('.') - 1 let b:csscompl = 1 while start >= 0 && line[start - 1] =~ '\(\k\|-\)' let start -= 1 endwhile endif endif if !exists("b:csscompl") let b:compl_context = getline('.')[0:(compl_begin)] let b:compl_context = matchstr(b:compl_context, '.*<\zs.*') else let b:compl_context = getline('.')[0:compl_begin] endif return start else " Initialize base return lists let res = [] let res2 = [] " a:base is very short - we need context let context = b:compl_context unlet! b:compl_context " Check if we should do CSS completion inside of