summaryrefslogtreecommitdiff
path: root/runtime/autoload
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-10-10 20:59:28 +0000
committerBram Moolenaar <Bram@vim.org>2005-10-10 20:59:28 +0000
commitd5cdbeb8dd859510c4674b17b67d613eff40a984 (patch)
tree7efb2d890b1eb727c0e15a2ade2613b606ad6c9b /runtime/autoload
parent196dfbcca1af4cf07f600e0186757d9adf097e7f (diff)
downloadvim-git-d5cdbeb8dd859510c4674b17b67d613eff40a984.tar.gz
updated for version 7.0155
Diffstat (limited to 'runtime/autoload')
-rw-r--r--runtime/autoload/README.txt8
-rw-r--r--runtime/autoload/ccomplete.vim40
-rw-r--r--runtime/autoload/csscomplete.vim42
-rw-r--r--runtime/autoload/htmlcomplete.vim193
4 files changed, 176 insertions, 107 deletions
diff --git a/runtime/autoload/README.txt b/runtime/autoload/README.txt
index 0c7fcfe38..2038fa224 100644
--- a/runtime/autoload/README.txt
+++ b/runtime/autoload/README.txt
@@ -4,6 +4,12 @@ These are functions used by plugins and for general use. They will be loaded
automatically when the function is invoked. See ":help autoload".
gzip.vim for editing compressed files
+netrw.vim browsing (remote) directories and editing remote files
+tar.vim browsing tar files
+zip.vim browsing zip files
Occult completion files:
-ccomplete.vim C
+ccomplete.vim C
+csscomplete.vim HTML / CSS
+htmlcomplete.vim HTML
+
diff --git a/runtime/autoload/ccomplete.vim b/runtime/autoload/ccomplete.vim
index c71852530..a2210d71b 100644
--- a/runtime/autoload/ccomplete.vim
+++ b/runtime/autoload/ccomplete.vim
@@ -1,7 +1,7 @@
" Vim completion script
" Language: C
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2005 Sep 13
+" Last Change: 2005 Oct 06
" This function is used for the 'omnifunc' option.
@@ -10,27 +10,52 @@ function! ccomplete#Complete(findstart, base)
" Locate the start of the item, including "." and "->".
let line = getline('.')
let start = col('.') - 1
+ let lastword = -1
while start > 0
- if line[start - 1] =~ '\w\|\.'
+ if line[start - 1] =~ '\w'
+ let start -= 1
+ elseif line[start - 1] =~ '\.'
+ if lastword == -1
+ let lastword = start
+ endif
let start -= 1
elseif start > 1 && line[start - 2] == '-' && line[start - 1] == '>'
+ if lastword == -1
+ let lastword = start
+ endif
let start -= 2
else
break
endif
endwhile
- return start
+
+ " Return the column of the last word, which is going to be changed.
+ " Remember the text that comes before it in s:prepended.
+ if lastword == -1
+ let s:prepended = ''
+ return start
+ endif
+ let s:prepended = strpart(line, start, lastword - start)
+ return lastword
endif
" Return list of matches.
+ let base = s:prepended . a:base
+
" Split item in words, keep empty word after "." or "->".
" "aa" -> ['aa'], "aa." -> ['aa', ''], "aa.bb" -> ['aa', 'bb'], etc.
- let items = split(a:base, '\.\|->', 1)
+ let items = split(base, '\.\|->', 1)
if len(items) <= 1
+ " Don't do anything for an empty base, would result in all the tags in the
+ " tags file.
+ if base == ''
+ return []
+ endif
+
" Only one part, no "." or "->": complete from tags file.
" When local completion is wanted CTRL-N would have been used.
- return map(taglist('^' . a:base), 'v:val["name"]')
+ return map(taglist('^' . base), 'v:val["name"]')
endif
" Find the variable items[0].
@@ -88,10 +113,7 @@ function! ccomplete#Complete(findstart, base)
endif
endif
- " The basetext is up to the last "." or "->" and won't be changed. The
- " matching members are concatenated to this.
- let basetext = matchstr(a:base, '.*\(\.\|->\)')
- return map(res, 'basetext . v:val["match"]')
+ return map(res, 'v:val["match"]')
endfunc
" Find composing type in "lead" and match items[0] with it.
diff --git a/runtime/autoload/csscomplete.vim b/runtime/autoload/csscomplete.vim
index ea52786e7..293c37031 100644
--- a/runtime/autoload/csscomplete.vim
+++ b/runtime/autoload/csscomplete.vim
@@ -1,12 +1,19 @@
" Vim completion script
" Language: CSS 2.1
" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
-" Last Change: 2005 Oct 02
+" Last Change: 2005 Oct 9
function! csscomplete#CompleteCSS(findstart, base)
if a:findstart
" We need whole line to proper checking
- return 0
+ let line = getline('.')
+ let start = col('.') - 1
+ let compl_begin = col('.') - 2
+ while start >= 0 && line[start - 1] =~ '\(\k\|-\)'
+ let start -= 1
+ endwhile
+ let b:compl_context = getline('.')[0:compl_begin]
+ return start
else
" There are few chars important for context:
" ^ ; : { } /* */
@@ -14,14 +21,16 @@ else
" Depending on their relative position to cursor we will now what should
" be completed.
" 1. if nearest are ^ or { or ; current word is property
- " 2. if : it is value
+ " 2. if : it is value (with exception of pseudo things)
" 3. if } we are outside of css definitions
" 4. for comments ignoring is be the easiest but assume they are the same
" as 1.
" 5. if @ complete at-rule
" 6. if ! complete important
- let line = a:base
+ let line = b:compl_context
+ unlet! b:compl_context
+
let res = []
let res2 = []
let borders = {}
@@ -67,19 +76,19 @@ else
let borders[exclam] = "exclam"
endif
+
if len(borders) == 0 || borders[min(keys(borders))] =~ '^\(openbrace\|semicolon\|opencomm\|closecomm\|style\)$'
" Complete properties
- let values = split("azimuth background-attachment background-color background-image background-position background-repeat background border-collapse border-color border-spacing border-style border-top border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width border-bottom-width border-left-width border-width border bottom caption-side clear clip color content counter-increment counter-reset cue-after cue-before cue cursor direction display elevation empty-cells float font-family font-size font-style font-variant font-weight font height left letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-right margin-left margin-top margin-bottom max-height max-width min-height min-width orphans outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page-break-after page-break-before page-break-inside pause-after pause-before pause pitch-range pitch play-during position quotes richness right speak-header speak-numeral speak-punctuation speak speech-rate stress table-layout text-align text-decoration text-indent text-transform top unicode-bidi vertical-align visibility voice-family volume white-space widows width word-spacing z-index")
+ let values = split("azimuth background background-attachment background-color background-image background-position background-repeat border bottom border-collapse border-color border-spacing border-style border-top border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width border-bottom-width border-left-width border-width caption-side clear clip color content counter-increment counter-reset cue cue-after cue-before cursor display direction elevation empty-cells float font font-family font-size font-style font-variant font-weight height left letter-spacing line-height list-style list-style-image list-style-position list-style-type margin margin-right margin-left margin-top margin-bottom max-height max-width min-height min-width orphans outline outline-color outline-style outline-width overflow padding padding-top padding-right padding-bottom padding-left page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position quotes right richness speak speak-header speak-numeral speak-punctuation speech-rate stress table-layout text-align text-decoration text-indent text-transform top unicode-bidi vertical-align visibility voice-family volume white-space width widows word-spacing z-index")
- let propbase = matchstr(line, '.\{-}\ze[a-zA-Z-]*$')
let entered_property = matchstr(line, '.\{-}\zs[a-zA-Z-]*$')
for m in values
if m =~? '^'.entered_property
- call add(res, propbase . m.': ')
+ call add(res, m . ':')
elseif m =~? entered_property
- call add(res2, propbase . m.': ')
+ call add(res2, m . ':')
endif
endfor
@@ -315,14 +324,13 @@ else
endif
" Complete values
- let valbase = matchstr(line, '.\{-}\ze[a-zA-Z0-9#,.(_-]*$')
let entered_value = matchstr(line, '.\{-}\zs[a-zA-Z0-9#,.(_-]*$')
for m in values
if m =~? '^'.entered_value
- call add(res, valbase . m)
+ call add(res, m)
elseif m =~? entered_value
- call add(res2, valbase . m)
+ call add(res2, m)
endif
endfor
@@ -335,14 +343,13 @@ else
elseif borders[min(keys(borders))] == 'exclam'
" Complete values
- let impbase = matchstr(line, '.\{-}!\s*\ze[a-zA-Z ]*$')
let entered_imp = matchstr(line, '.\{-}!\s*\zs[a-zA-Z ]*$')
let values = ["important"]
for m in values
if m =~? '^'.entered_imp
- call add(res, impbase . m)
+ call add(res, m)
endif
endfor
@@ -388,9 +395,9 @@ else
for m in values
if m =~? '^'.entered_atruleafter
- call add(res, atruleafterbase . m)
+ call add(res, m)
elseif m =~? entered_atruleafter
- call add(res2, atruleafterbase . m)
+ call add(res2, m)
endif
endfor
@@ -400,14 +407,13 @@ else
let values = ["charset", "page", "media", "import", "font-face"]
- let atrulebase = matchstr(line, '.*@\ze[a-zA-Z -]*$')
let entered_atrule = matchstr(line, '.*@\zs[a-zA-Z-]*$')
for m in values
if m =~? '^'.entered_atrule
- call add(res, atrulebase . m.' ')
+ call add(res, m .' ')
elseif m =~? entered_atrule
- call add(res2, atrulebase . m.' ')
+ call add(res2, m .' ')
endif
endfor
diff --git a/runtime/autoload/htmlcomplete.vim b/runtime/autoload/htmlcomplete.vim
index 9dd5830a1..b3dae2d30 100644
--- a/runtime/autoload/htmlcomplete.vim
+++ b/runtime/autoload/htmlcomplete.vim
@@ -1,39 +1,76 @@
" Vim completion script
" Language: XHTML 1.0 Strict
" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
-" Last Change: 2005 Sep 23
+" Last Change: 2005 Oct 9
function! htmlcomplete#CompleteTags(findstart, base)
if a:findstart
" locate the start of the word
let line = getline('.')
let start = col('.') - 1
- while start >= 0 && line[start - 1] !~ '<'
- let start -= 1
+ let compl_begin = col('.') - 2
+ while start >= 0 && line[start - 1] =~ '\(\k\|[:.-]\)'
+ let start -= 1
endwhile
- if start < 0
+ if start >= 0 && line[start - 1] =~ '&'
+ let b:entitiescompl = 1
+ let b:compl_context = ''
+ return start
+ endif
+ let stylestart = searchpair('<style\>', '', '<\/style\>', "bnW")
+ let styleend = searchpair('<style\>', '', '<\/style\>', "nW")
+ if stylestart != 0 && styleend != 0
let curpos = line('.')
- let stylestart = searchpair('<style\>', '', '<\/style\>', "bnW")
- let styleend = searchpair('<style\>', '', '<\/style\>', "nW")
- if stylestart != 0 && styleend != 0
- if stylestart <= curpos && styleend >= curpos
- let b:csscompl = 1
- let start = 0
- endif
+ 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 <style> tag
if exists("b:csscompl")
unlet! b:csscompl
- return csscomplete#CompleteCSS(0, a:base)
+ return csscomplete#CompleteCSS(0, context)
+ endif
+ " Make entities completion
+ if exists("b:entitiescompl")
+ unlet! b:entitiescompl
+
+ " Very, very long line
+ let values = ["AElig", "Aacute", "Acirc", "Agrave", "Alpha", "Aring", "Atilde", "Auml", "Beta", "Ccedil", "Chi", "Dagger", "Delta", "ETH", "Eacute", "Ecirc", "Egrave", "Epsilon", "Eta", "Euml", "Gamma", "Iacute", "Icirc", "Igrave", "Iota", "Iuml", "Kappa", "Lambda", "Mu", "Ntilde", "Nu", "OElig", "Oacute", "Ocirc", "Ograve", "Omega", "Omicron", "Oslash", "Otilde", "Ouml", "Phi", "Pi", "Prime", "Psi", "Rho", "Scaron", "Sigma", "THORN", "TITY", "Tau", "Theta", "Uacute", "Ucirc", "Ugrave", "Upsilon", "Uuml", "Xi", "Yacute", "Yuml", "Zeta", "aacute", "acirc", "acute", "aelig", "agrave", "alefsym", "alpha", "amp", "and", "ang", "apos", "aring", "asymp", "atilde", "auml", "bdquo", "beta", "brvbar", "bull", "cap", "ccedil", "cedil", "cent", "chi", "circ", "clubs", "copy", "cong", "crarr", "cup", "curren", "dArr", "dagger", "darr", "deg", "delta", "diams", "divide", "eacute", "ecirc", "egrave", "empty", "ensp", "emsp", "epsilon", "equiv", "eta", "eth", "euro", "euml", "exist", "fnof", "forall", "frac12", "frac14", "frac34", "frasl", "gt", "gamma", "ge", "hArr", "harr", "hearts", "hellip", "iacute", "icirc", "iexcl", "igrave", "image", "infin", "int", "iota", "iquest", "isin", "iuml", "kappa", "lt", "laquo", "lArr", "lambda", "lang", "larr", "lceil", "ldquo", "le", "lfloor", "lowast", "loz", "lrm", "lsaquo", "lsquo", "macr", "mdash", "micro", "middot", "minus", "mu", "nbsp", "nabla", "ndash", "ne", "ni", "not", "notin", "nsub", "ntilde", "nu", "oacute", "ocirc", "oelig", "ograve", "oline", "omega", "omicron", "oplus", "or", "ordf", "ordm", "oslash", "otilde", "otimes", "ouml", "para", "part", "permil", "perp", "phi", "pi", "piv", "plusmn", "pound", "prime", "prod", "prop", "psi", "quot", "rArr", "raquo", "radic", "rang", "rarr", "rceil", "rdquo", "real", "reg", "rfloor", "rho", "rlm", "rsaquo", "rsquo", "sbquo", "scaron", "sdot", "sect", "shy", "sigma", "sigmaf", "sim", "spades", "sub", "sube", "sum", "sup", "sup1", "sup2", "sup3", "supe", "szlig", "tau", "there4", "theta", "thetasym", "thinsp", "thorn", "tilde", "times", "trade", "uArr", "uacute", "uarr", "ucirc", "ugrave", "uml", "upsih", "upsilon", "uuml", "weierp", "xi", "yacute", "yen", "yuml", "zeta", "zwj", "zwnj"]
+
+ for m in sort(values)
+ if m =~? '^'.a:base
+ call add(res, m.';')
+ elseif m =~? a:base
+ call add(res2, m.';')
+ endif
+ endfor
+
+ return res + res2
+
endif
- if a:base =~ '>'
- " Generally if a:base contains > it means we are outside of tag and
+ if context =~ '>'
+ " Generally if context contains > it means we are outside of tag and
" should abandon action - with one exception: <style> span { bo
- if a:base =~ 'style[^>]\{-}>[^<]\{-}$'
- return csscomplete#CompleteCSS(0, a:base)
+ if context =~ 'style[^>]\{-}>[^<]\{-}$'
+ return csscomplete#CompleteCSS(0, context)
else
return []
endif
@@ -43,34 +80,32 @@ function! htmlcomplete#CompleteTags(findstart, base)
let coreattrs = ["id", "class", "style", "title"]
let i18n = ["lang", "xml:lang", "dir=\"ltr\" ", "dir=\"rtl\" "]
let events = ["onclick", "ondblclick", "onmousedown", "onmouseup", "onmousemove",
- \ "onmouseout", "onkeypress", "onkeydown", "onkeyup"]
+ \ "onmouseover", "onmouseout", "onkeypress", "onkeydown", "onkeyup"]
let focus = ["accesskey", "tabindex", "onfocus", "onblur"]
let coregroup = coreattrs + i18n + events
- let res = []
- let res2 = []
- " find tags matching with "a:base"
- " If a:base contains > it means we are already outside of tag and we
+ " find tags matching with "context"
+ " If context contains > it means we are already outside of tag and we
" should abandon action
- " If a:base contains white space it is attribute.
+ " If context contains white space it is attribute.
" It could be also value of attribute...
" We have to get first word to offer
" proper completions
- let tag = split(a:base)[0]
+ if context == ''
+ let tag = ''
+ else
+ let tag = split(context)[0]
+ endif
" Get last word, it should be attr name
- let attr = matchstr(a:base, '.*\s\zs.*')
+ let attr = matchstr(context, '.*\s\zs.*')
" Possible situations where any prediction would be difficult:
" 1. Events attributes
- if a:base =~ '\s'
+ if context =~ '\s'
" Sort out style, class, and on* cases
- " Perfect solution for style would be switching for CSS completion. Is
- " it possible?
- " Also retrieving class names from current file and linked
- " stylesheets.
- if a:base =~ "\\(on[a-z]*\\|id\\|style\\|class\\)\\s*=\\s*[\"']"
- if a:base =~ "\\(id\\|class\\)\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$"
- if a:base =~ "class\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$"
+ if context =~ "\\(on[a-z]*\\|id\\|style\\|class\\)\\s*=\\s*[\"']"
+ if context =~ "\\(id\\|class\\)\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$"
+ if context =~ "class\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$"
let search_for = "class"
- elseif a:base =~ "id\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$"
+ elseif context =~ "id\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$"
let search_for = "id"
endif
" Handle class name completion
@@ -217,27 +252,27 @@ function! htmlcomplete#CompleteTags(findstart, base)
endif
" We need special version of sbase
- let classbase = matchstr(a:base, ".*[\"']")
+ let classbase = matchstr(context, ".*[\"']")
let classquote = matchstr(classbase, '.$')
let entered_class = matchstr(attr, ".*=\\s*[\"']\\zs.*")
for m in sort(values)
if m =~? '^'.entered_class
- call add(res, classbase . m . classquote . ' ')
+ call add(res, m . classquote)
elseif m =~? entered_class
- call add(res2, classbase . m . classquote . ' ')
+ call add(res2, m . classquote)
endif
endfor
return res + res2
- elseif a:base =~ "style\\s*=\\s*[\"'][^\"']*$"
- return csscomplete#CompleteCSS(0, a:base)
+ elseif context =~ "style\\s*=\\s*[\"'][^\"']*$"
+ return csscomplete#CompleteCSS(0, context)
endif
- let stripbase = matchstr(a:base, ".*\\(on[a-z]*\\|style\\|class\\)\\s*=\\s*[\"']\\zs.*")
- " Now we have a:base stripped from all chars up to style/class.
+ let stripbase = matchstr(context, ".*\\(on[a-z]*\\|style\\|class\\)\\s*=\\s*[\"']\\zs.*")
+ " Now we have context stripped from all chars up to style/class.
" It may fail with some strange style value combinations.
if stripbase !~ "[\"']"
return []
@@ -254,7 +289,7 @@ function! htmlcomplete#CompleteTags(findstart, base)
elseif attrname == 'xml:space'
let values = ["preserve"]
elseif attrname == 'shape'
- if a:base =~ '^a\>'
+ if context =~ '^a\>'
let values = ["rect"]
else
let values = ["rect", "circle", "poly", "default"]
@@ -287,13 +322,13 @@ function! htmlcomplete#CompleteTags(findstart, base)
endfor
endif
elseif attrname == 'type'
- if a:base =~ '^input'
+ if context =~ '^input'
let values = ["text", "password", "checkbox", "radio", "submit", "reset", "file", "hidden", "image", "button"]
- elseif a:base =~ '^button'
+ elseif context =~ '^button'
let values = ["button", "submit", "reset"]
- elseif a:base =~ '^style'
+ elseif context =~ '^style'
let values = ["text/css"]
- elseif a:base =~ '^script'
+ elseif context =~ '^script'
let values = ["text/javascript"]
endif
else
@@ -305,7 +340,7 @@ function! htmlcomplete#CompleteTags(findstart, base)
endif
" We need special version of sbase
- let attrbase = matchstr(a:base, ".*[\"']")
+ let attrbase = matchstr(context, ".*[\"']")
let attrquote = matchstr(attrbase, '.$')
for m in values
@@ -313,23 +348,23 @@ function! htmlcomplete#CompleteTags(findstart, base)
" alphabetically but sort them. Those beginning with entered
" part will be as first choices
if m =~ '^'.entered_value
- call add(res, attrbase . m . attrquote.' ')
+ call add(res, m . attrquote.' ')
elseif m =~ entered_value
- call add(res2, attrbase . m . attrquote.' ')
+ call add(res2, m . attrquote.' ')
endif
endfor
return res + res2
endif
- " Shorten a:base to not include last word
- let sbase = matchstr(a:base, '.*\ze\s.*')
- if tag =~ '^\(abbr\|acronym\|b\|bdo\|big\|caption\|cite\|code\|dd\|dfn\|div\|dl\|dt\|em\|fieldset\|h\d\|kbd\|li\|noscript\|ol\|p\|samp\|small\|span\|strong\|sub\|sup\|tt\|ul\|var\)$'
+ " Shorten context to not include last word
+ let sbase = matchstr(context, '.*\ze\s.*')
+ if tag =~ '^\(abbr\|acronym\|address\|b\|bdo\|big\|caption\|cite\|code\|dd\|dfn\|div\|dl\|dt\|em\|fieldset\|h\d\|hr\|i\|kbd\|li\|noscript\|ol\|p\|samp\|small\|span\|strong\|sub\|sup\|tt\|ul\|var\)$'
let attrs = coregroup
elseif tag == 'a'
let attrs = coregroup + focus + ["charset", "type", "name", "href", "hreflang", "rel", "rev", "shape", "coords"]
elseif tag == 'area'
- let attrs = coregroup
+ let attrs = coregroup + focus + ["shape", "coords", "href", "nohref", "alt"]
elseif tag == 'base'
let attrs = ["href", "id"]
elseif tag == 'blockquote'
@@ -339,27 +374,27 @@ function! htmlcomplete#CompleteTags(findstart, base)
elseif tag == 'br'
let attrs = coreattrs
elseif tag == 'button'
- let attrs = coreattrs + focus + ["name", "value", "type"]
+ let attrs = coregroup + focus + ["name", "value", "type"]
elseif tag == '^\(col\|colgroup\)$'
- let attrs = coreattrs + ["span", "width", "align", "char", "charoff", "valign"]
+ let attrs = coregroup + ["span", "width", "align", "char", "charoff", "valign"]
elseif tag =~ '^\(del\|ins\)$'
- let attrs = coreattrs + ["cite", "datetime"]
+ let attrs = coregroup + ["cite", "datetime"]
elseif tag == 'form'
- let attrs = coreattrs + ["action", "method=\"get\" ", "method=\"post\" ", "enctype", "onsubmit", "onreset", "accept", "accept-charset"]
+ let attrs = coregroup + ["action", "method=\"get\" ", "method=\"post\" ", "enctype", "onsubmit", "onreset", "accept", "accept-charset"]
elseif tag == 'head'
let attrs = i18n + ["id", "profile"]
elseif tag == 'html'
let attrs = i18n + ["id", "xmlns"]
elseif tag == 'img'
- let attrs = coreattrs + ["src", "alt", "longdesc", "height", "width", "usemap", "ismap"]
+ let attrs = coregroup + ["src", "alt", "longdesc", "height", "width", "usemap", "ismap"]
elseif tag == 'input'
- let attrs = coreattrs + focus + ["type", "name", "value", "checked", "disabled", "readonly", "size", "maxlength", "src", "alt", "usemap", "onselect", "onchange", "accept"]
+ let attrs = coregroup + ["type", "name", "value", "checked", "disabled", "readonly", "size", "maxlength", "src", "alt", "usemap", "onselect", "onchange", "accept"]
elseif tag == 'label'
- let attrs = coreattrs + ["for", "accesskey", "onfocus", "onblur"]
+ let attrs = coregroup + ["for", "accesskey", "onfocus", "onblur"]
elseif tag == 'legend'
- let attrs = coreattrs + ["accesskey"]
+ let attrs = coregroup + ["accesskey"]
elseif tag == 'link'
- let attrs = coreattrs + ["charset", "href", "hreflang", "type", "rel", "rev", "media"]
+ let attrs = coregroup + ["charset", "href", "hreflang", "type", "rel", "rev", "media"]
elseif tag == 'map'
let attrs = i18n + events + ["id", "class", "style", "title", "name"]
elseif tag == 'meta'
@@ -367,31 +402,31 @@ function! htmlcomplete#CompleteTags(findstart, base)
elseif tag == 'title'
let attrs = i18n + ["id"]
elseif tag == 'object'
- let attrs = coreattrs + ["declare", "classid", "codebase", "data", "type", "codetype", "archive", "standby", "height", "width", "usemap", "name", "tabindex"]
+ let attrs = coregroup + ["declare", "classid", "codebase", "data", "type", "codetype", "archive", "standby", "height", "width", "usemap", "name", "tabindex"]
elseif tag == 'optgroup'
- let attrs = coreattrs + ["disbled", "label"]
+ let attrs = coregroup + ["disbled", "label"]
elseif tag == 'option'
- let attrs = coreattrs + ["disbled", "selected", "value", "label"]
+ let attrs = coregroup + ["disbled", "selected", "value", "label"]
elseif tag == 'param'
let attrs = ["id", "name", "value", "valuetype", "type"]
elseif tag == 'pre'
- let attrs = coreattrs + ["xml:space"]
+ let attrs = coregroup + ["xml:space"]
elseif tag == 'q'
- let attrs = coreattrs + ["cite"]
+ let attrs = coregroup + ["cite"]
elseif tag == 'script'
let attrs = ["id", "charset", "type=\"text/javascript\"", "type", "src", "defer", "xml:space"]
elseif tag == 'select'
- let attrs = coreattrs + ["name", "size", "multiple", "disabled", "tabindex", "onfocus", "onblur", "onchange"]
+ let attrs = coregroup + ["name", "size", "multiple", "disabled", "tabindex", "onfocus", "onblur", "onchange"]
elseif tag == 'style'
let attrs = coreattrs + ["id", "type=\"text/css\"", "type", "media", "title", "xml:space"]
elseif tag == 'table'
- let attrs = coreattrs + ["summary", "width", "border", "frame", "rules", "cellspacing", "cellpadding"]
+ let attrs = coregroup + ["summary", "width", "border", "frame", "rules", "cellspacing", "cellpadding"]
elseif tag =~ '^\(thead\|tfoot\|tbody\|tr\)$'
- let attrs = coreattrs + ["align", "char", "charoff", "valign"]
+ let attrs = coregroup + ["align", "char", "charoff", "valign"]
elseif tag == 'textarea'
- let attrs = coreattrs + focus + ["name", "rows", "cols", "disabled", "readonly", "onselect", "onchange"]
+ let attrs = coregroup + ["name", "rows", "cols", "disabled", "readonly", "onselect", "onchange"]
elseif tag =~ '^\(th\|td\)$'
- let attrs = coreattrs + ["abbr", "headers", "scope", "rowspan", "colspan", "align", "char", "charoff", "valign"]
+ let attrs = coregroup + ["abbr", "headers", "scope", "rowspan", "colspan", "align", "char", "charoff", "valign"]
else
return []
endif
@@ -399,15 +434,15 @@ function! htmlcomplete#CompleteTags(findstart, base)
for m in sort(attrs)
if m =~ '^'.attr
if m =~ '^\(ismap\|defer\|declare\|nohref\|checked\|disabled\|selected\|readonly\)$' || m =~ '='
- call add(res, sbase.' '.m)
+ call add(res, m)
else
- call add(res, sbase.' '.m.'="')
+ call add(res, m.'="')
endif
elseif m =~ attr
if m =~ '^\(ismap\|defer\|declare\|nohref\|checked\|disabled\|selected\|readonly\)$' || m =~ '='
- call add(res2, sbase.' '.m)
+ call add(res2, m)
else
- call add(res2, sbase.' '.m.'="')
+ call add(res2, m.'="')
endif
endif
endfor
@@ -417,9 +452,9 @@ function! htmlcomplete#CompleteTags(findstart, base)
endif
" Close tag
let b:unaryTagsStack = "base meta link hr br param img area input col"
- if a:base =~ '^\/'
+ if context =~ '^\/'
let opentag = htmlcomplete#GetLastOpenTag("b:unaryTagsStack")
- return ["/".opentag.">"]
+ return [opentag.">"]
endif
" Deal with tag completion.
let opentag = htmlcomplete#GetLastOpenTag("b:unaryTagsStack")
@@ -481,9 +516,9 @@ function! htmlcomplete#CompleteTags(findstart, base)
endif
for m in tags
- if m =~ '^'.a:base
+ if m =~ '^'.context
call add(res, m)
- elseif m =~ a:base
+ elseif m =~ context
call add(res2, m)
endif
endfor