updated for version 7.0194

This commit is contained in:
Bram Moolenaar
2006-02-08 09:20:24 +00:00
parent 9f2c6e1deb
commit 8b6144bdfe
31 changed files with 822 additions and 346 deletions

View File

@@ -1,7 +1,7 @@
" Vim completion script " Vim completion script
" Language: C " Language: C
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2006 Feb 03 " Last Change: 2006 Feb 06
" This function is used for the 'omnifunc' option. " This function is used for the 'omnifunc' option.
@@ -213,22 +213,29 @@ endfunction
" If it is a variable we may add "." or "->". Don't do it for other types, " If it is a variable we may add "." or "->". Don't do it for other types,
" such as a typedef, by not including the info that s:GetAddition() uses. " such as a typedef, by not including the info that s:GetAddition() uses.
function! s:Tag2item(val) function! s:Tag2item(val)
let x = substitute(a:val['cmd'], '^/^', '', '')
let x = substitute(x, '$/$', '', '')
let x = substitute(x, a:val['name'], '@@', '')
if has_key(a:val, "kind") if has_key(a:val, "kind")
if a:val["kind"] == 'v' if a:val["kind"] == 'v'
return {'match': a:val['name'], 'tagline': "\t" . a:val['cmd'], 'dict': a:val} return {'match': a:val['name'], 'tagline': "\t" . a:val['cmd'], 'dict': a:val, 'extra': x}
endif endif
if a:val["kind"] == 'f' if a:val["kind"] == 'f'
return {'match': a:val['name'] . '(', 'tagline': ""} return {'match': a:val['name'] . '(', 'tagline': "", 'extra': x}
endif endif
endif endif
return {'match': a:val['name'], 'tagline': ''} return {'match': a:val['name'], 'tagline': '', 'extra': x}
endfunction endfunction
" Turn a match item "val" into an item for completion. " Turn a match item "val" into an item for completion.
" "val['match']" is the matching item. " "val['match']" is the matching item.
" "val['tagline']" is the tagline in which the last part was found. " "val['tagline']" is the tagline in which the last part was found.
function! s:Tagline2item(val, brackets) function! s:Tagline2item(val, brackets)
return a:val['match'] . a:brackets . s:GetAddition(a:val['tagline'], a:val['match'], [a:val], a:brackets == '') let word = a:val['match'] . a:brackets . s:GetAddition(a:val['tagline'], a:val['match'], [a:val], a:brackets == '')
if has_key(a:val, 'extra')
return {'word': word, 'menu': a:val['extra']}
endif
return {'word': word, 'menu': substitute(a:val['tagline'], word, '@@', '')}
endfunction endfunction

View File

@@ -1,7 +1,7 @@
" Vim completion script " Vim completion script
" Language: XHTML 1.0 Strict " Language: XHTML 1.0 Strict
" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) " Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
" Last Change: 2006 Jan 30 " Last Change: 2006 Feb 6
function! htmlcomplete#CompleteTags(findstart, base) function! htmlcomplete#CompleteTags(findstart, base)
if a:findstart if a:findstart
@@ -13,11 +13,14 @@ function! htmlcomplete#CompleteTags(findstart, base)
while start >= 0 && line[start - 1] =~ '\(\k\|[:.-]\)' while start >= 0 && line[start - 1] =~ '\(\k\|[:.-]\)'
let start -= 1 let start -= 1
endwhile endwhile
" Handling of entities {{{
if start >= 0 && line[start - 1] =~ '&' if start >= 0 && line[start - 1] =~ '&'
let b:entitiescompl = 1 let b:entitiescompl = 1
let b:compl_context = '' let b:compl_context = ''
return start return start
endif endif
" }}}
" Handling of <style> tag {{{
let stylestart = searchpair('<style\>', '', '<\/style\>', "bnW") let stylestart = searchpair('<style\>', '', '<\/style\>', "bnW")
let styleend = searchpair('<style\>', '', '<\/style\>', "nW") let styleend = searchpair('<style\>', '', '<\/style\>', "nW")
if stylestart != 0 && styleend != 0 if stylestart != 0 && styleend != 0
@@ -29,6 +32,8 @@ function! htmlcomplete#CompleteTags(findstart, base)
endwhile endwhile
endif endif
endif endif
" }}}
" Handling of <script> tag {{{
let scriptstart = searchpair('<script\>', '', '<\/script\>', "bnW") let scriptstart = searchpair('<script\>', '', '<\/script\>', "bnW")
let scriptend = searchpair('<script\>', '', '<\/script\>', "nW") let scriptend = searchpair('<script\>', '', '<\/script\>', "nW")
if scriptstart != 0 && scriptend != 0 if scriptstart != 0 && scriptend != 0
@@ -36,16 +41,44 @@ function! htmlcomplete#CompleteTags(findstart, base)
let start = col('.') - 1 let start = col('.') - 1
let b:jscompl = 1 let b:jscompl = 1
let b:jsrange = [scriptstart, scriptend] let b:jsrange = [scriptstart, scriptend]
while start >= 0 && line[start - 1] =~ '\(\k\|-\)' while start >= 0 && line[start - 1] =~ '\w'
let start -= 1 let start -= 1
endwhile endwhile
" We are inside of <script> tag. But we should also get contents
" of all linked external files and (secondary, less probably) other <script> tags
" This logic could possible be done in separate function - may be
" reused in events scripting (also with option could be reused for
" CSS
let b:js_extfiles = []
let l = line('.')
let c = col('.')
call cursor(1,1)
while search('<\@<=script\>', 'W') && line('.') <= l
if synIDattr(synID(line('.'),col('.')-1,0),"name") !~? 'comment'
let sname = matchstr(getline('.'), '<script[^>]*src\s*=\s*\([''"]\)\zs.\{-}\ze\1')
if filereadable(sname)
let b:js_extfiles += readfile(sname)
endif
endif
endwhile
call cursor(1,1)
let js_scripttags = []
while search('<script\>', 'W') && line('.') < l
if matchstr(getline('.'), '<script[^>]*src') == ''
let js_scripttag = getline(line('.'), search('</script>', 'W'))
let js_scripttags += js_scripttag
endif
endwhile
let b:js_extfiles += js_scripttags
call cursor(l,c)
unlet! l c
endif endif
endif endif
" }}}
if !exists("b:csscompl") && !exists("b:jscompl") if !exists("b:csscompl") && !exists("b:jscompl")
let b:compl_context = getline('.')[0:(compl_begin)] let b:compl_context = getline('.')[0:(compl_begin)]
if b:compl_context !~ '<[^>]*$' if b:compl_context !~ '<[^>]*$'
" Look like we may have broken tag. Check previous lines. Up to " Look like we may have broken tag. Check previous lines.
" 10?
let i = 1 let i = 1
while 1 while 1
let context_line = getline(curline-i) let context_line = getline(curline-i)
@@ -65,6 +98,14 @@ function! htmlcomplete#CompleteTags(findstart, base)
unlet! i unlet! i
endif endif
let b:compl_context = matchstr(b:compl_context, '.*\zs<.*') let b:compl_context = matchstr(b:compl_context, '.*\zs<.*')
" Return proper start for on-events. Without that beginning of
" completion will be badly reported
if b:compl_context =~? 'on[a-z]*\s*=\s*\(''[^'']*\|"[^"]*\)$'
let start = col('.') - 1
while start >= 0 && line[start - 1] =~ '\w'
let start -= 1
endwhile
endif
else else
let b:compl_context = getline('.')[0:compl_begin] let b:compl_context = getline('.')[0:compl_begin]
endif endif
@@ -76,14 +117,15 @@ function! htmlcomplete#CompleteTags(findstart, base)
" a:base is very short - we need context " a:base is very short - we need context
let context = b:compl_context let context = b:compl_context
" Check if we should do CSS completion inside of <style> tag " Check if we should do CSS completion inside of <style> tag
" or JS completion inside of <script> tag
if exists("b:csscompl") if exists("b:csscompl")
unlet! b:csscompl unlet! b:csscompl
let context = b:compl_context let context = b:compl_context
unlet! b:compl_context
return csscomplete#CompleteCSS(0, context) return csscomplete#CompleteCSS(0, context)
elseif exists("b:jscompl") elseif exists("b:jscompl")
unlet! b:jscompl unlet! b:jscompl
let context = b:compl_context return javascriptcomplete#CompleteJS(0, a:base)
return javascriptcomplete#CompleteJS(0, context)
else else
if len(b:compl_context) == 0 && !exists("b:entitiescompl") if len(b:compl_context) == 0 && !exists("b:entitiescompl")
return [] return []
@@ -91,7 +133,7 @@ function! htmlcomplete#CompleteTags(findstart, base)
let context = matchstr(b:compl_context, '.\zs.*') let context = matchstr(b:compl_context, '.\zs.*')
endif endif
unlet! b:compl_context unlet! b:compl_context
" Make entities completion " Entities completion {{{
if exists("b:entitiescompl") if exists("b:entitiescompl")
unlet! b:entitiescompl unlet! b:entitiescompl
@@ -122,6 +164,7 @@ function! htmlcomplete#CompleteTags(findstart, base)
endif endif
" }}}
if context =~ '>' if context =~ '>'
" Generally if context contains > it means we are outside of tag and " Generally if context contains > it means we are outside of tag and
" should abandon action - with one exception: <style> span { bo " should abandon action - with one exception: <style> span { bo
@@ -142,13 +185,11 @@ function! htmlcomplete#CompleteTags(findstart, base)
\ "onmouseover", "onmouseout", "onkeypress", "onkeydown", "onkeyup"] \ "onmouseover", "onmouseout", "onkeypress", "onkeydown", "onkeyup"]
let focus = ["accesskey", "tabindex", "onfocus", "onblur"] let focus = ["accesskey", "tabindex", "onfocus", "onblur"]
let coregroup = coreattrs + i18n + events let coregroup = coreattrs + i18n + events
" find tags matching with "context"
" If context contains > it means we are already outside of tag and we " If context contains > it means we are already outside of tag and we
" should abandon action " should abandon action
" If context contains white space it is attribute. " If context contains white space it is attribute.
" It could be also value of attribute... " It can be also value of attribute.
" We have to get first word to offer " We have to get first word to offer proper completions
" proper completions
if context == '' if context == ''
let tag = '' let tag = ''
else else
@@ -160,11 +201,12 @@ function! htmlcomplete#CompleteTags(findstart, base)
" 1. Events attributes " 1. Events attributes
if context =~ '\s' if context =~ '\s'
" Sort out style, class, and on* cases " Sort out style, class, and on* cases
if context =~ "\\(on[a-z]*\\|id\\|style\\|class\\)\\s*=\\s*[\"']" if context =~? "\\(on[a-z]*\\|id\\|style\\|class\\)\\s*=\\s*[\"']"
if context =~ "\\(id\\|class\\)\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$" " Id, class completion {{{
if context =~ "class\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$" if context =~? "\\(id\\|class\\)\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$"
if context =~? "class\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$"
let search_for = "class" let search_for = "class"
elseif context =~ "id\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$" elseif context =~? "id\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$"
let search_for = "id" let search_for = "id"
endif endif
" Handle class name completion " Handle class name completion
@@ -327,17 +369,59 @@ function! htmlcomplete#CompleteTags(findstart, base)
return res + res2 return res + res2
elseif context =~ "style\\s*=\\s*[\"'][^\"']*$" elseif context =~? "style\\s*=\\s*[\"'][^\"']*$"
return csscomplete#CompleteCSS(0, context) return csscomplete#CompleteCSS(0, context)
endif endif
let stripbase = matchstr(context, ".*\\(on[a-z]*\\|style\\|class\\)\\s*=\\s*[\"']\\zs.*") " }}}
" Complete on-events {{{
if context =~? 'on[a-z]*\s*=\s*\(''[^'']*\|"[^"]*\)$'
" We have to:
" 1. Find external files
let b:js_extfiles = []
let l = line('.')
let c = col('.')
call cursor(1,1)
while search('<\@<=script\>', 'W') && line('.') <= l
if synIDattr(synID(line('.'),col('.')-1,0),"name") !~? 'comment'
let sname = matchstr(getline('.'), '<script[^>]*src\s*=\s*\([''"]\)\zs.\{-}\ze\1')
if filereadable(sname)
let b:js_extfiles += readfile(sname)
endif
endif
endwhile
" 2. Find at least one <script> tag
call cursor(1,1)
let js_scripttags = []
while search('<script\>', 'W') && line('.') < l
if matchstr(getline('.'), '<script[^>]*src') == ''
let js_scripttag = getline(line('.'), search('</script>', 'W'))
let js_scripttags += js_scripttag
endif
endwhile
let b:js_extfiles += js_scripttags
" 3. Proper call for javascriptcomplete#CompleteJS
call cursor(l,c)
let js_context = matchstr(a:base, '\w\+$')
let js_shortcontext = substitute(a:base, js_context.'$', '', '')
let b:compl_context = context
let b:jsrange = [l, l]
unlet! l c
"return map(javascriptcomplete#CompleteJS(0, js_context), 'js_shortcontext.v:val')
return javascriptcomplete#CompleteJS(0, js_context)
endif
" }}}
let stripbase = matchstr(context, ".*\\(on[a-zA-Z]*\\|style\\|class\\)\\s*=\\s*[\"']\\zs.*")
" Now we have context stripped from all chars up to style/class. " Now we have context stripped from all chars up to style/class.
" It may fail with some strange style value combinations. " It may fail with some strange style value combinations.
if stripbase !~ "[\"']" if stripbase !~ "[\"']"
return [] return []
endif endif
endif endif
" Value of attribute completion {{{
" If attr contains =\s*[\"'] we catched value of attribute " If attr contains =\s*[\"'] we catched value of attribute
if attr =~ "=\s*[\"']" if attr =~ "=\s*[\"']"
" Let do attribute specific completion " Let do attribute specific completion
@@ -413,6 +497,8 @@ function! htmlcomplete#CompleteTags(findstart, base)
return res + res2 return res + res2
endif endif
" }}}
" Attribute completion {{{
" Shorten context to not include last word " Shorten context to not include last word
let sbase = matchstr(context, '.*\ze\s.*') 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\)$' 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\)$'
@@ -506,7 +592,8 @@ function! htmlcomplete#CompleteTags(findstart, base)
return res + res2 return res + res2
endif endif
" Close tag " }}}
" Close tag {{{
let b:unaryTagsStack = "base meta link hr br param img area input col" let b:unaryTagsStack = "base meta link hr br param img area input col"
if context =~ '^\/' if context =~ '^\/'
let opentag = xmlcomplete#GetLastOpenTag("b:unaryTagsStack") let opentag = xmlcomplete#GetLastOpenTag("b:unaryTagsStack")
@@ -521,10 +608,13 @@ function! htmlcomplete#CompleteTags(findstart, base)
" If returns empty string assume <body>. Safe bet. " If returns empty string assume <body>. Safe bet.
let opentag = 'body' let opentag = 'body'
endif endif
" }}}
" Load data {{{
if !exists("g:xmldata_xhtml10s") if !exists("g:xmldata_xhtml10s")
runtime! autoload/xml/xhtml10s.vim runtime! autoload/xml/xhtml10s.vim
endif endif
" }}}
" Tag completion {{{
let tags = g:xmldata_xhtml10s[opentag][0] let tags = g:xmldata_xhtml10s[opentag][0]
@@ -538,5 +628,7 @@ function! htmlcomplete#CompleteTags(findstart, base)
return res + res2 return res + res2
" }}}
endif endif
endfunction endfunction
" vim:set foldmethod=marker:

View File

@@ -1,33 +1,47 @@
" Vim completion script " Vim completion script
" Language: Java Script " Language: Java Script
" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) " Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
" Last Change: 2006 Jan 30 " Last Change: 2006 Feb 6
function! javascriptcomplete#CompleteJS(findstart, base) function! javascriptcomplete#CompleteJS(findstart, base)
if a:findstart if a:findstart
" locate the start of the word " locate the start of the word
let line = getline('.') let line = getline('.')
let start = col('.') - 1 let start = col('.') - 1
let curline = line('.') let curline = line('.')
let compl_begin = col('.') - 2 let compl_begin = col('.') - 2
" Bit risky but JS is rather limited language and local chars shouldn't " Bit risky but JS is rather limited language and local chars shouldn't
" fint way into names " fint way into names
while start >= 0 && line[start - 1] =~ '\w' while start >= 0 && line[start - 1] =~ '\w'
let start -= 1 let start -= 1
endwhile endwhile
let b:compl_context = getline('.')[0:compl_begin] let b:compl_context = getline('.')[0:compl_begin]
return start return start
else else
" Initialize base return lists " Initialize base return lists
let res = [] let res = []
let res2 = [] let res2 = []
" a:base is very short - we need context " a:base is very short - we need context
let context = b:compl_context
" Shortcontext is context without a:base, useful for checking if we are " Shortcontext is context without a:base, useful for checking if we are
" looking for objects " looking for objects and for what objects we are looking for
let context = b:compl_context
let shortcontext = substitute(context, a:base.'$', '', '') let shortcontext = substitute(context, a:base.'$', '', '')
unlet! b:compl_context unlet! b:compl_context
if exists("b:jsrange")
let file = getline(b:jsrange[0],b:jsrange[1])
unlet! b:jsrange
if len(b:js_extfiles) > 0
let file = b:js_extfiles + file
endif
else
let file = getline(1, '$')
endif
" Completion of properties, methods, etc. {{{
if shortcontext =~ '\.$' if shortcontext =~ '\.$'
" Complete methods and properties for objects " Complete methods and properties for objects
" DOM separate " DOM separate
@@ -91,7 +105,7 @@ function! javascriptcomplete#CompleteJS(findstart, base)
" RegExp " RegExp
let regeprop = ['constructor', 'global', 'ignoreCase', 'lastIndex', 'multiline', 'source', 'prototype'] let regeprop = ['constructor', 'global', 'ignoreCase', 'lastIndex', 'multiline', 'source', 'prototype']
let regemeth = ['exec', 'toSource', 'toString', 'test', 'watch', 'unwatch'] let regemeth = ['exec', 'test', 'toSource', 'toString', 'watch', 'unwatch']
call map(regemeth, 'v:val."("') call map(regemeth, 'v:val."("')
let reges = regeprop + regemeth let reges = regeprop + regemeth
@@ -106,19 +120,17 @@ function! javascriptcomplete#CompleteJS(findstart, base)
let stris = striprop + strimeth let stris = striprop + strimeth
" User created properties " User created properties
if exists("b:jsrange")
let file = getline(b:jsrange[0],b:jsrange[1])
unlet! b:jsrange
else
let file = getline(1, '$')
endif
let user_props1 = filter(copy(file), 'v:val =~ "this\\.\\w"') let user_props1 = filter(copy(file), 'v:val =~ "this\\.\\w"')
let juser_props1 = join(user_props1, ' ') let juser_props1 = join(user_props1, ' ')
let user_props1 = split(juser_props1, '\zethis\.') let user_props1 = split(juser_props1, '\zethis\.')
unlet! juser_props1 unlet! juser_props1
call map(user_props1, 'matchstr(v:val, "this\\.\\zs\\w\\+\\ze")') call map(user_props1, 'matchstr(v:val, "this\\.\\zs\\w\\+\\ze")')
let user_props2 = filter(copy(file), 'v:val =~ "\\.prototype\\.\\w"') let user_props2 = filter(copy(file), 'v:val =~ "\\.prototype\\.\\w"')
call map(user_props2, 'matchstr(v:val, "\\.prototype\\.\\zs\\w\\+\\ze")') let juser_props2 = join(user_props2, ' ')
let user_props2 = split(juser_props2, '\zeprototype\.')
unlet! juser_props2
call map(user_props2, 'matchstr(v:val, "prototype\\.\\zs\\w\\+\\ze")')
let user_props = user_props1 + user_props2 let user_props = user_props1 + user_props2
" HTML DOM properties " HTML DOM properties
@@ -149,7 +161,15 @@ function! javascriptcomplete#CompleteJS(findstart, base)
\ 'onClick', 'onDblClick', 'onFocus', 'onKeyDown', 'onKeyPress', 'onKeyUp', \ 'onClick', 'onDblClick', 'onFocus', 'onKeyDown', 'onKeyPress', 'onKeyUp',
\ 'onMouseDown', 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp', 'onResize'] \ 'onMouseDown', 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp', 'onResize']
call map(documeth, 'v:val."("') call map(documeth, 'v:val."("')
let docus = docuprop + documeth let docuxprop = ['attributes', 'childNodes', 'doctype', 'documentElement', 'firstChild',
\ 'implementation', 'namespaceURI', 'nextSibling', 'nodeName', 'nodeType',
\ 'nodeValue', 'ownerDocument', 'parentNode', 'previousSibling']
let docuxmeth = ['createAttribute', 'createCDATASection',
\ 'createComment', 'createDocument', 'createDocumentFragment',
\ 'createElement', 'createEntityReference', 'createProcessingInstruction',
\ 'createTextNode']
call map(docuxmeth, 'v:val."("')
let docus = docuprop + docuxprop + documeth + docuxmeth
" Form - form. " Form - form.
let formprop = ['elements', 'acceptCharset', 'action', 'encoding', 'enctype', 'id', 'length', let formprop = ['elements', 'acceptCharset', 'action', 'encoding', 'enctype', 'id', 'length',
\ 'method', 'name', 'tabIndex', 'target'] \ 'method', 'name', 'tabIndex', 'target']
@@ -178,7 +198,7 @@ function! javascriptcomplete#CompleteJS(findstart, base)
let ifras = ifraprop let ifras = ifraprop
" Image - image. " Image - image.
let imagprop = ['align', 'alt', 'border', 'complete', 'height', 'hspace', 'id', 'isMap', 'longDesc', let imagprop = ['align', 'alt', 'border', 'complete', 'height', 'hspace', 'id', 'isMap', 'longDesc',
\ 'lowsrc', 'name', 'src', 'useMap', 'vspace', 'width'] \ 'lowSrc', 'name', 'src', 'useMap', 'vspace', 'width']
let imagmeth = ['onAbort', 'onError', 'onLoad'] let imagmeth = ['onAbort', 'onError', 'onLoad']
call map(imagmeth, 'v:val."("') call map(imagmeth, 'v:val."("')
let imags = histprop + imagmeth let imags = histprop + imagmeth
@@ -282,13 +302,13 @@ function! javascriptcomplete#CompleteJS(findstart, base)
\ 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', \ 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor',
\ 'borderBottomStyle', 'borderLeftStyle', 'borderRightStyle', 'borderTopStyle', \ 'borderBottomStyle', 'borderLeftStyle', 'borderRightStyle', 'borderTopStyle',
\ 'borderBottomWidth', 'borderLeftWidth', 'borderRightWidth', 'borderTopWidth', \ 'borderBottomWidth', 'borderLeftWidth', 'borderRightWidth', 'borderTopWidth',
\ 'borderColor', 'borderStyle', 'borderWidth', 'margin', 'marginBottom', \ 'borderColor', 'borderStyle', 'borderWidth', 'margin', 'marginBottom',
\ 'marginLeft', 'marginRight', 'marginTop', 'outline', 'outlineStyle', 'outlineWidth', \ 'marginLeft', 'marginRight', 'marginTop', 'outline', 'outlineStyle', 'outlineWidth',
\ 'outlineColor', 'outlineStyle', 'outlineWidth', 'padding', 'paddingBottom', \ 'outlineColor', 'outlineStyle', 'outlineWidth', 'padding', 'paddingBottom',
\ 'paddingLeft', 'paddingRight', 'paddingTop', \ 'paddingLeft', 'paddingRight', 'paddingTop',
\ 'clear', 'clip', 'clipBottom', 'clipLeft', 'clipRight', 'clipTop', 'content', \ 'clear', 'clip', 'clipBottom', 'clipLeft', 'clipRight', 'clipTop', 'content',
\ 'counterIncrement', 'counterReset', 'cssFloat', 'cursor', 'direction', \ 'counterIncrement', 'counterReset', 'cssFloat', 'cursor', 'direction',
\ 'display', 'markerOffset', 'marks', 'maxHeight', 'maxWidth', 'minHeight', \ 'display', 'markerOffset', 'marks', 'maxHeight', 'maxWidth', 'minHeight',
\ 'minWidth', 'overflow', 'overflowX', 'overflowY', 'verticalAlign', 'visibility', \ 'minWidth', 'overflow', 'overflowX', 'overflowY', 'verticalAlign', 'visibility',
\ 'width', \ 'width',
\ 'listStyle', 'listStyleImage', 'listStylePosition', 'listStyleType', \ 'listStyle', 'listStyleImage', 'listStylePosition', 'listStyleType',
@@ -320,13 +340,14 @@ function! javascriptcomplete#CompleteJS(findstart, base)
" Textarea - accessible only by other properties " Textarea - accessible only by other properties
let tareprop = ['accessKey', 'cols', 'defaultValue', let tareprop = ['accessKey', 'cols', 'defaultValue',
\ 'disabled', 'form', 'id', 'name', 'readOnly', 'rows', \ 'disabled', 'form', 'id', 'name', 'readOnly', 'rows',
\ 'tabIndex', 'type', 'value'] \ 'tabIndex', 'type', 'value', 'selectionStart', 'selectionEnd']
let taremeth = ['blur', 'focus', 'select', 'onBlur', 'onChange', 'onFocus'] let taremeth = ['blur', 'focus', 'select', 'onBlur', 'onChange', 'onFocus']
call map(taremeth, 'v:val."("') call map(taremeth, 'v:val."("')
let tares = tareprop + taremeth let tares = tareprop + taremeth
" Window - window. " Window - window.
let windprop = ['frames', 'closed', 'defaultStatus', 'length', 'name', 'opener', 'parent', let windprop = ['frames', 'closed', 'defaultStatus', 'encodeURI', 'event', 'history',
\ 'self', 'status', 'top'] \ 'length', 'location', 'name', 'onload', 'opener', 'parent', 'screen', 'self',
\ 'status', 'top', 'XMLHttpRequest', 'ActiveXObject']
let windmeth = ['alert', 'blur', 'clearInterval', 'clearTimeout', 'close', 'confirm', 'focus', let windmeth = ['alert', 'blur', 'clearInterval', 'clearTimeout', 'close', 'confirm', 'focus',
\ 'moveBy', 'moveTo', 'open', 'print', 'prompt', 'scrollBy', 'scrollTo', 'setInterval', \ 'moveBy', 'moveTo', 'open', 'print', 'prompt', 'scrollBy', 'scrollTo', 'setInterval',
\ 'setTimeout'] \ 'setTimeout']
@@ -334,15 +355,81 @@ function! javascriptcomplete#CompleteJS(findstart, base)
let winds = windprop + windmeth let winds = windprop + windmeth
" XMLHttpRequest - access by new xxx() " XMLHttpRequest - access by new xxx()
let xmlhprop = ['onreadystatechange', 'readyState', 'responseText', 'responseXML', let xmlhprop = ['onreadystatechange', 'readyState', 'responseText', 'responseXML',
\ 'status', 'statusText'] \ 'status', 'statusText', 'parseError']
let xmlhmeth = ['abort', 'getAllResponseHeaders', 'getResponseHeaders', 'open', let xmlhmeth = ['abort', 'getAllResponseHeaders', 'getResponseHeaders', 'open',
\ 'send', 'setRequestHeader'] \ 'send', 'setRequestHeader']
call map(xmlhmeth, 'v:val."("') call map(xmlhmeth, 'v:val."("')
let xmlhs = xmlhprop + xmlhmeth let xmlhs = xmlhprop + xmlhmeth
" XML DOM
" Attributes - element.attributes[x].
let xdomattrprop = ['name', 'specified', 'value']
" Element - anyelement.
let xdomelemprop = ['attributes', 'childNodes', 'firstChild', 'lastChild',
\ 'namespaceURI', 'nextSibling', 'nodeName', 'nodeType', 'nodeValue',
\ 'ownerDocument', 'parentNode', 'prefix', 'previousSibling', 'tagName']
let xdomelemmeth = ['appendChild', 'cloneNode', 'getAttribute', 'getAttributeNode',
\ 'getElementsByTagName', 'hasChildNodes', 'insertBefore', 'normalize',
\ 'removeAttribute', 'removeAttributeNode', 'removeChild', 'replaceChild',
\ 'setAttribute', 'setAttributeNode']
call map(xdomelemmeth, 'v:val."("')
let xdomelems = xdomelemprop + xdomelemmeth
" Node - anynode.
let xdomnodeprop = ['attributes', 'childNodes', 'firstChild', 'lastChild',
\ 'namespaceURI', 'nextSibling', 'nodeName', 'nodeType', 'nodeValue',
\ 'ownerDocument', 'parentNode', 'prefix', 'previousSibling']
let xdomnodemeth = ['appendChild', 'cloneNode',
\ 'hasChildNodes', 'insertBefore', 'removeChild', 'replaceChild']
call map(xdomnodemeth, 'v:val."("')
let xdomnodes = xdomnodeprop + xdomnodemeth
" NodeList
let xdomnliss = ['length', 'item(']
" Error - parseError.
let xdomerror = ['errorCode', 'reason', 'line', 'linepos', 'srcText', 'url', 'filepos']
" Find object type declaration to reduce number of suggestions. {{{
" 1. Get object name
" 2. Find object declaration line
" 3. General declaration follows "= new Type" syntax, additional else
" for regexp "= /re/"
" 4. Make correction for Microsoft.XMLHTTP ActiveXObject
" 5. Repeat for external files
let object = matchstr(shortcontext, '\zs\w\+\ze\(\[.\{-}\]\)\?\.$') let object = matchstr(shortcontext, '\zs\w\+\ze\(\[.\{-}\]\)\?\.$')
let decl_line = search(object.'.\{-}=\s*new\s*', 'bn') if len(object) > 0
let object_type = matchstr(getline(decl_line), object.'.\{-}=\s*new\s*\zs\w\+\ze') let decl_line = search(object.'.\{-}=\s*new\s*', 'bn')
if decl_line > 0
let object_type = matchstr(getline(decl_line), object.'.\{-}=\s*new\s*\zs\w\+\ze')
if object_type == 'ActiveXObject' && matchstr(getline(decl_line), object.'.\{-}=\s*new\s*ActiveXObject\s*(.Microsoft\.XMLHTTP.)') != ''
let object_type = 'XMLHttpRequest'
endif
else
let decl_line = search('var\s*'.object.'\s*=\s*\/', 'bn')
if decl_line > 0
let object_type = 'RegExp'
endif
endif
" We didn't find var declaration in current file but we may have
" something in external files.
if decl_line == 0 && exists("b:js_extfiles")
let dext_line = filter(copy(b:js_extfiles), 'v:val =~ "'.object.'.\\{-}=\\s*new\\s*"')
if len(dext_line) > 0
let object_type = matchstr(dext_line[-1], object.'.\{-}=\s*new\s*\zs\w\+\ze')
if object_type == 'ActiveXObject' && matchstr(dext_line[-1], object.'.\{-}=\s*new\s*ActiveXObject\s*(.Microsoft\.XMLHTTP.)') != ''
let object_type = 'XMLHttpRequest'
endif
else
let dext_line = filter(copy(b:js_extfiles), 'v:val =~ "var\s*'.object.'\\s*=\\s*\\/"')
if len(dext_line) > 0
let object_type = 'RegExp'
endif
endif
endif
endif
" }}}
if !exists('object_type')
let object_type = ''
endif
if object_type == 'Date' if object_type == 'Date'
let values = dates let values = dates
@@ -357,13 +444,17 @@ function! javascriptcomplete#CompleteJS(findstart, base)
let values = xmlhs let values = xmlhs
elseif object_type == 'String' elseif object_type == 'String'
let values = stris let values = stris
elseif object_type == 'RegExp'
let values = reges
elseif object_type == 'Math'
let values = maths
endif endif
if !exists('values') if !exists('values')
" List of properties " List of properties
if shortcontext =~ 'Math\.$' if shortcontext =~ 'Math\.$'
let values = maths let values = maths
elseif shortcontext =~ 'anchor\.$' elseif shortcontext =~ 'anchors\(\[.\{-}\]\)\?\.$'
let values = anths let values = anths
elseif shortcontext =~ 'area\.$' elseif shortcontext =~ 'area\.$'
let values = areas let values = areas
@@ -373,7 +464,7 @@ function! javascriptcomplete#CompleteJS(findstart, base)
let values = bodys let values = bodys
elseif shortcontext =~ 'document\.$' elseif shortcontext =~ 'document\.$'
let values = docus let values = docus
elseif shortcontext =~ 'form\.$' elseif shortcontext =~ 'forms\(\[.\{-}\]\)\?\.$'
let values = forms let values = forms
elseif shortcontext =~ 'frameset\.$' elseif shortcontext =~ 'frameset\.$'
let values = fsets let values = fsets
@@ -381,9 +472,9 @@ function! javascriptcomplete#CompleteJS(findstart, base)
let values = hists let values = hists
elseif shortcontext =~ 'iframe\.$' elseif shortcontext =~ 'iframe\.$'
let values = ifras let values = ifras
elseif shortcontext =~ 'image\.$' elseif shortcontext =~ 'images\(\[.\{-}\]\)\?\.$'
let values = imags let values = imags
elseif shortcontext =~ 'link\.$' elseif shortcontext =~ 'links\(\[.\{-}\]\)\?\.$'
let values = links let values = links
elseif shortcontext =~ 'location\.$' elseif shortcontext =~ 'location\.$'
let values = locas let values = locas
@@ -405,11 +496,16 @@ function! javascriptcomplete#CompleteJS(findstart, base)
let values = trows let values = trows
elseif shortcontext =~ 'window\.$' elseif shortcontext =~ 'window\.$'
let values = winds let values = winds
elseif shortcontext =~ 'parseError\.$'
let values = xdomerror
elseif shortcontext =~ 'attributes\[\d\+\]\.$'
let values = xdomattrprop
else else
let values = user_props + arrays + dates + funcs + maths + numbs + objes + reges + stris let values = user_props + arrays + dates + funcs + maths + numbs + objes + reges + stris
let values += doms + anths + areas + bases + bodys + docus + forms + frams + fsets + hists let values += doms + anths + areas + bases + bodys + docus + forms + frams + fsets + hists
let values += ifras + imags + links + locas + metas + navis + objes + scres + styls let values += ifras + imags + links + locas + metas + navis + objes + scres
let values += tabls + trows + winds let values += tabls + trows + tares + winds
let values += xdomnodes + xdomnliss + xdomelems
endif endif
endif endif
@@ -425,21 +521,15 @@ function! javascriptcomplete#CompleteJS(findstart, base)
return res + res2 return res + res2
endif endif
" }}}
if exists("b:jsrange")
let file = getline(b:jsrange[0],b:jsrange[1])
unlet! b:jsrange
else
let file = getline(1, '$')
endif
" Get variables data. " Get variables data.
let variables = filter(copy(file), 'v:val =~ "var\\s"') let variables = filter(copy(file), 'v:val =~ "var\\s"')
call map(variables, 'matchstr(v:val, ".\\{-}var\\s\\+\\zs.*\\ze")') call map(variables, 'matchstr(v:val, ".\\{-}var\\s\\+\\zs.*\\ze")')
call map(variables, 'substitute(v:val, ";\\|$", ",", "g")') call map(variables, 'substitute(v:val, ";\\|$", ",", "g")')
let vars = [] let vars = []
" This loop is necessary to get variable names from constructs like: " This loop (and next one) is necessary to get variable names from
" var var1, var2, var3 = "something"; " constructs like: var var1, var2, var3 = "something";
for i in range(len(variables)) for i in range(len(variables))
let comma_separated = split(variables[i], ',\s*') let comma_separated = split(variables[i], ',\s*')
call map(comma_separated, 'matchstr(v:val, "\\w\\+")') call map(comma_separated, 'matchstr(v:val, "\\w\\+")')
@@ -447,27 +537,36 @@ function! javascriptcomplete#CompleteJS(findstart, base)
endfor endfor
let variables = sort(vars) let variables = sort(vars)
unlet! vars
" Add undeclared variables. " Add "no var" variables.
let undeclared_variables = filter(copy(file), 'v:val =~ "^\\s*\\w\\+\\s*="') let undeclared_variables = filter(copy(file), 'v:val =~ "^\\s*\\w\\+\\s*="')
call map(undeclared_variables, 'matchstr(v:val, "^\\s*\\zs\\w\\+\\ze")') let u_vars = []
for i in range(len(undeclared_variables))
let split_equal = split(undeclared_variables[i], '\s*=')
call map(split_equal, 'matchstr(v:val, "\\w\\+$")')
let u_vars += split_equal
endfor
let variables += sort(undeclared_variables) let variables += sort(u_vars)
unlet! u_vars
" Get functions " Get functions
let functions = filter(copy(file), 'v:val =~ "^\\s*function\\s"') let functions = filter(copy(file), 'v:val =~ "^\\s*function\\s"')
let arguments = copy(functions) let arguments = copy(functions)
call map(functions, 'matchstr(v:val, "^\\s*function\\s\\+\\zs\\w\\+")') call map(functions, 'matchstr(v:val, "^\\s*function\\s\\+\\zs\\w\\+")')
call map(functions, 'v:val."("') call map(functions, 'v:val."("')
let functions = sort(functions)
" Get functions arguments " Get functions arguments
call map(arguments, 'matchstr(v:val, "function.\\{-}(\\zs.\\{-}\\ze)")') call map(arguments, 'matchstr(v:val, "function.\\{-}(\\zs.\\{-}\\ze)")')
let jargs = join(arguments, ',') let jargs = join(arguments, ',')
let jargs = substitute(jargs, '\s', '', 'g') let jargs = substitute(jargs, '\s', '', 'g')
let arguments = split(jargs, ',') let arguments = split(jargs, ',')
let arguments = sort(arguments)
" Built-in functions " Built-in functions
let builtin = [] let builtin = ['alert(', 'confirm(']
" Top-level HTML DOM objects " Top-level HTML DOM objects
let htmldom = ['document', 'anchor', 'area', 'base', 'body', 'document', 'event', 'form', 'frame', 'frameset', 'history', 'iframe', 'image', 'input', 'link', 'location', 'meta', 'navigator', 'object', 'option', 'screen', 'select', 'table', 'tableData', 'tableHeader', 'tableRow', 'textarea', 'window'] let htmldom = ['document', 'anchor', 'area', 'base', 'body', 'document', 'event', 'form', 'frame', 'frameset', 'history', 'iframe', 'image', 'input', 'link', 'location', 'meta', 'navigator', 'object', 'option', 'screen', 'select', 'table', 'tableData', 'tableHeader', 'tableRow', 'textarea', 'window']
@@ -493,3 +592,5 @@ function! javascriptcomplete#CompleteJS(findstart, base)
return res + res2 return res + res2
endfunction endfunction
" vim:set foldmethod=marker:

View File

@@ -1,7 +1,7 @@
" Vim completion script " Vim completion script
" Language: XML " Language: XML
" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) " Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
" Last Change: 2006 Jan 24 " Last Change: 2006 Feb 6
" This function will create Dictionary with users namespace strings and values " This function will create Dictionary with users namespace strings and values
" canonical (system) names of data files. Names should be lowercase, " canonical (system) names of data files. Names should be lowercase,
@@ -396,11 +396,11 @@ return ''
endfunction endfunction
function! s:InComment() function! s:InComment()
return synIDattr(synID(line('.'), col('.'), 0), 'name') =~ 'Comment' return synIDattr(synID(line('.'), col('.'), 0), 'name') =~ 'Comment\|String'
endfunction endfunction
function! s:InCommentAt(line, col) function! s:InCommentAt(line, col)
return synIDattr(synID(a:line, a:col, 0), 'name') =~ 'Comment' return synIDattr(synID(a:line, a:col, 0), 'name') =~ 'Comment\|String'
endfunction endfunction
function! s:SetKeywords() function! s:SetKeywords()

View File

@@ -1235,6 +1235,7 @@ The commands are sorted on the non-optional part of their name.
|:lgetfile| :lg[etfile] read file with locations |:lgetfile| :lg[etfile] read file with locations
|:lgrep| :lgr[ep] run 'grepprg' and jump to first match |:lgrep| :lgr[ep] run 'grepprg' and jump to first match
|:lgrepadd| :lgrepa[dd] like :grep, but append to current list |:lgrepadd| :lgrepa[dd] like :grep, but append to current list
|:lhelpgrep| :lh[elpgrep] like ":helpgrep" but uses location list
|:ll| :ll go to specific location |:ll| :ll go to specific location
|:llast| :lla[st] go to the specified location, default last one |:llast| :lla[st] go to the specified location, default last one
|:llist| :lli[st] list all locations |:llist| :lli[st] list all locations

View File

@@ -1,4 +1,4 @@
*insert.txt* For Vim version 7.0aa. Last change: 2006 Jan 30 *insert.txt* For Vim version 7.0aa. Last change: 2006 Feb 07
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -956,39 +956,61 @@ FUNCTIONS FOR FINDING COMPLETIONS *complete-functions*
This applies to 'completefunc' and 'omnifunc'. This applies to 'completefunc' and 'omnifunc'.
The function will be invoked with two arguments. First the function is called The function is called in two different ways:
to find the start of the text to be completed. Secondly the function is - First the function is called to find the start of the text to be completed.
called to actually find the matches. - Later the function is called to actually find the matches.
On the first invocation the arguments are: On the first invocation the arguments are:
a:findstart 1 a:findstart 1
a:base empty a:base empty
The function must return the column of where the completion starts. It must The function must return the column where the completion starts. It must be a
be a number between zero and the cursor column "col('.')". This involves number between zero and the cursor column "col('.')". This involves looking
looking at the characters just before the cursor and including those at the characters just before the cursor and including those characters that
characters that could be part of the completed item. The text between this could be part of the completed item. The text between this column and the
column and the cursor column will be replaced with the matches. Return -1 if cursor column will be replaced with the matches. Return -1 if no completion
no completion can be done. can be done.
On the second invocation the arguments are: On the second invocation the arguments are:
a:findstart 0 a:findstart 0
a:base the text with which matches should match, what was a:base the text with which matches should match; the text that was
located in the first call (can be empty) located in the first call (can be empty)
The function must return a List with the matching words. These matches The function must return a List with the matching words. These matches
usually include the "a:base" text. When there are no matches return an empty usually include the "a:base" text. When there are no matches return an empty
List. When one of the items in the list cannot be used as a string (e.g., a List.
Dictionary) then an error message is given and further items in the list are
not used. Each list item can either be a string or a Dictionary. When it is a string it
is used as the completion. When it is a Dictionary it can contain these
items:
word the completion, mandatory
menu extra text for the popup menu
info more information about the item
kind single letter indicating the type of completion
All of these must be a string. If an item does not meet these requirements
then an error message is given and further items in the list are not used.
You can mix string and Dictionary items in the returned list.
The "menu" item is used in the popup menu and may be truncated, thus it should
be relatively short. The "info" item can be longer, it may be displayed in a
balloon.
The "kind" item uses a single letter to indicate the kind of completion. This
may be used to show the completion differently (different color or icon).
Currently these types can be used:
v variable
f function or method
c composite (struct, object)
When searching for matches takes some time call |complete_add()| to add each When searching for matches takes some time call |complete_add()| to add each
match to the total list. These matches should then not appear in the returned match to the total list. These matches should then not appear in the returned
list! Call |complete_check()| now and then to allow the user to press a key list! Call |complete_check()| now and then to allow the user to press a key
while still searching for matches. Stop searching when it returns non-zero. while still searching for matches. Stop searching when it returns non-zero.
The function may move the cursor, it is restored afterwards. This option The function is allowed to move the cursor, it is restored afterwards. This
cannot be set from a |modeline| or in the |sandbox|, for security reasons. option cannot be set from a |modeline| or in the |sandbox|, for security
reasons.
An example that completes the names of the months: > An example that completes the names of the months: >
fun! CompleteMonths(findstart, base) fun! CompleteMonths(findstart, base)
@@ -1050,11 +1072,16 @@ The menu is used when:
- There are at least two matches. - There are at least two matches.
While the menu is displayed these keys have a special meaning: While the menu is displayed these keys have a special meaning:
<CR> and <Enter>: Accept the currently selected match <CR> and <Enter> Accept the currently selected match
<Up>: Select the previous match, as if CTRL-P was used <Up> Select the previous match, as if CTRL-P was used
<Down>: Select the next match, as if CTRL-N was used <Down> Select the next match, as if CTRL-N was used
<PageUp>: Select a match several entries back <PageUp> Select a match several entries back
<PageDown>: Select a match several entries further <PageDown> Select a match several entries further
<BS> and CTRL-H Delete one character, find the matches for the shorter word
before the cursor. This may find more matches.
CTRL-L Add one character from the current match, may reduce the
number of matches. Does not work after selecting one of the
matches with CTRL-N, <Up>, etc.
The colors of the menu can be changed with these highlight groups: The colors of the menu can be changed with these highlight groups:
Pmenu normal item |hl-Pmenu| Pmenu normal item |hl-Pmenu|
@@ -1073,6 +1100,8 @@ because it adds extra information that is needed for completion. You can find
it here: http://ctags.sourceforge.net/ it here: http://ctags.sourceforge.net/
For version 5.5.4 you should add a patch that adds the "typename:" field: For version 5.5.4 you should add a patch that adds the "typename:" field:
ftp://ftp.vim.org/pub/vim/unstable/patches/ctags-5.5.4.patch ftp://ftp.vim.org/pub/vim/unstable/patches/ctags-5.5.4.patch
A compiled .exe for MS-Windows can be found at:
http://georgevreilly.com/vim/ctags.html
If you want to complete system functions you can do something like this. Use If you want to complete system functions you can do something like this. Use
ctags to generate a tags file for all the system header files: > ctags to generate a tags file for all the system header files: >
@@ -1104,14 +1133,14 @@ Complete properties and their appropriate values according to CSS 2.1
specification. specification.
(X)HTML *ft-html-omni* HTML and XHTML *ft-html-omni*
*ft-xhtml-omni* *ft-xhtml-omni*
CTRL-X CTRL-O provides completion of various elements of (X)HTML files. CTRL-X CTRL-O provides completion of various elements of (X)HTML files.
It is designed to support writing of XHTML 1.0 Strict files but will It is designed to support writing of XHTML 1.0 Strict files but will
also works for other versions of HTML. Features: also works for other versions of HTML. Features:
- after "<" complete tag name depending on context (no div suggest - after "<" complete tag name depending on context (no div suggestion
inside of an a tag) inside of an a tag)
- inside of tag complete proper attributes (no width attribute for an - inside of tag complete proper attributes (no width attribute for an
a tag) a tag)
@@ -1120,17 +1149,21 @@ also works for other versions of HTML. Features:
- complete names of entities - complete names of entities
- complete values of "class" and "id" attributes with data obtained from - complete values of "class" and "id" attributes with data obtained from
style tag and included CSS files style tag and included CSS files
- when completing "style" attribute or working inside of "style" tag - when completing value of "style" attribute or working inside of "style" tag
switch to |ft-css-omni| completion switch to |ft-css-omni| completion
- when completing values of events attributes or working inside of "script" tag
switch to |ft-javascript-omni| completion
- when used after "</" CTRL-X CTRL-O will close the last opened tag - when used after "</" CTRL-X CTRL-O will close the last opened tag
Note: When used first time completion menu will be shown with little delay Note: When used first time completion menu will be shown with little delay
- this is time needed for loading of data file. - this is time needed for loading of data file.
Note: Completion may fail in badly formatted documents. In such case try to
run |:make| command to detect formatting problems.
JAVASCRIPT *ft-javascript-omni* JAVASCRIPT *ft-javascript-omni*
Completion of most elements of JavaScript language and HTML DOM. Completion of most elements of JavaScript language and DOM elements.
Complete: Complete:
@@ -1138,13 +1171,13 @@ Complete:
- function name - function name
- function arguments - function arguments
- properties of variables trying to detect type of variable - properties of variables trying to detect type of variable
- complete HTML DOM objects and properties depending on context - complete DOM objects and properties depending on context
- keywords of language - keywords of language
Completion works in separate JavaScript files (&ft==javascript) and inside of Completion works in separate JavaScript files (&ft==javascript), inside of
<script> tag of (X)HTML. Note: scanning will be only in scope of current tag. <script> tag of (X)HTML and in values of event attributes (including scanning
At the moment separate files are not taken into account. of external files.
DOM compatibility DOM compatibility
At the moment (beginning of 2006) there are two main browsers - MS Internet At the moment (beginning of 2006) there are two main browsers - MS Internet

View File

@@ -1,4 +1,4 @@
*netbeans.txt* For Vim version 7.0aa. Last change: 2005 Apr 04 *netbeans.txt* For Vim version 7.0aa. Last change: 2006 Feb 05
VIM REFERENCE MANUAL by Gordon Prieur VIM REFERENCE MANUAL by Gordon Prieur
@@ -179,6 +179,7 @@ These messages are specific for NetBeans:
Region is guarded, cannot modify Region is guarded, cannot modify
NetBeans defines guarded areas in the text, which you cannot NetBeans defines guarded areas in the text, which you cannot
change. change.
Also sets the current buffer, if necessary.
*E656* *E656*
NetBeans disallows writes of unmodified buffers NetBeans disallows writes of unmodified buffers
@@ -485,8 +486,10 @@ setContentType
Not implemented. Not implemented.
setDot off Make the buffer the current buffer and set the cursor at the setDot off Make the buffer the current buffer and set the cursor at the
specified position. If there are folds they are opened to specified position. If the buffer is open in another window
make the cursor line visible. than make that window the current window.
If there are folds they are opened to make the cursor line
visible.
In version 2.1 "lnum/col" can be used instead of "off". In version 2.1 "lnum/col" can be used instead of "off".
setExitDelay seconds setExitDelay seconds
@@ -566,6 +569,7 @@ stopDocumentListen
unguard off len unguard off len
Opposite of "guard", remove guarding for a text area. Opposite of "guard", remove guarding for a text area.
Also sets the current buffer, if necessary.
version Not implemented. version Not implemented.
@@ -612,6 +616,7 @@ insert off text
123 no problem 123 no problem
123 !message failed 123 !message failed
Note that the message in the reply is not quoted. Note that the message in the reply is not quoted.
Also sets the current buffer, if necessary.
remove off length remove off length
Delete "length" bytes of text at position "off". Both Delete "length" bytes of text at position "off". Both
@@ -620,6 +625,7 @@ remove off length
123 no problem 123 no problem
123 !message failed 123 !message failed
Note that the message in the reply is not quoted. Note that the message in the reply is not quoted.
Also sets the current buffer, if necessary.
saveAndExit Perform the equivalent of closing Vim: ":confirm qall". saveAndExit Perform the equivalent of closing Vim: ":confirm qall".
If there are no changed files or the user does not cancel the If there are no changed files or the user does not cancel the

View File

@@ -2151,6 +2151,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
:lgrep quickfix.txt /*:lgrep* :lgrep quickfix.txt /*:lgrep*
:lgrepa quickfix.txt /*:lgrepa* :lgrepa quickfix.txt /*:lgrepa*
:lgrepadd quickfix.txt /*:lgrepadd* :lgrepadd quickfix.txt /*:lgrepadd*
:lh various.txt /*:lh*
:lhelpgrep various.txt /*:lhelpgrep*
:list various.txt /*:list* :list various.txt /*:list*
:ll quickfix.txt /*:ll* :ll quickfix.txt /*:ll*
:lla quickfix.txt /*:lla* :lla quickfix.txt /*:lla*
@@ -5420,7 +5422,6 @@ hebrew hebrew.txt /*hebrew*
hebrew.txt hebrew.txt /*hebrew.txt* hebrew.txt hebrew.txt /*hebrew.txt*
help various.txt /*help* help various.txt /*help*
help-context help.txt /*help-context* help-context help.txt /*help-context*
help-tags tags 1
help-translated various.txt /*help-translated* help-translated various.txt /*help-translated*
help-xterm-window various.txt /*help-xterm-window* help-xterm-window various.txt /*help-xterm-window*
help.txt help.txt /*help.txt* help.txt help.txt /*help.txt*

View File

@@ -1,4 +1,4 @@
*todo.txt* For Vim version 7.0aa. Last change: 2006 Feb 04 *todo.txt* For Vim version 7.0aa. Last change: 2006 Feb 07
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -30,25 +30,19 @@ be worked on, but only if you sponsor Vim development. See |sponsor|.
*known-bugs* *known-bugs*
-------------------- Known bugs and current work ----------------------- -------------------- Known bugs and current work -----------------------
Variant of ":helpgrep" that uses a location list? How about: Crash with X command server (Ciaran McCreesh).
:lhelpgrep (use local list in help window, not current window)
ccomplete / omnicomplete: ccomplete / omnicomplete:
- Extra info for each entry to show in a tooltip kind of thing. When editing compl_leader <CR> should accept the current match.
Should use a dictionary for each entry. Fields could be: Somehow select another match without changing the compl_leader, so that you
word the completed word can use CTRL-L next? Perhaps with <S-Up> and <S-Down>?
menu menu text (use word when missing)
info extra info, to be displayed in balloon (e.g., function args)
kind single letter indicating the type of word:
v = variable, f = function/method, c = composite (object,
struct pointer).
For C add tag "kind" field?
- Complete the longest common match instead of the first match? - Complete the longest common match instead of the first match?
Do this when "longest" is in 'completeopt'. Do this when "longest" is in 'completeopt'.
Pressing CTRL-N or CTRL-P will get the whole match, as before. Pressing CTRL-N or CTRL-P will get the whole match, as before.
Need to postpone inserting anything until all matches have been found. Need to postpone inserting anything until all matches have been found.
Then add a completion item with the longest common string (after what was Then add a completion item with the longest common string (after what was
typed), if there is one. typed), if there is one.
- For C add tag "kind" field to each match?
- Finding out if an item has members (to add '.' or '->') requires a grep in - Finding out if an item has members (to add '.' or '->') requires a grep in
the tags files, that is very slow. Is there another solution? At least the tags files, that is very slow. Is there another solution? At least
stop at the first match. stop at the first match.
@@ -109,6 +103,9 @@ Nov 24)
An error in a function uses a line number that doesn't take line continuation An error in a function uses a line number that doesn't take line continuation
into account. (Mikolaj Machowski) Store line count in an extra array? into account. (Mikolaj Machowski) Store line count in an extra array?
Is it possible to keep the command-line window open? Would actually work like
closing it, executing the command and re-opening it (at the same position).
Mac unicode patch (Da Woon Jung): Mac unicode patch (Da Woon Jung):
- selecting proportional font breaks display - selecting proportional font breaks display
- UTF-8 text causes display problems. Font replacement causes this. - UTF-8 text causes display problems. Font replacement causes this.

View File

@@ -648,6 +648,15 @@ g CTRL-A Only when Vim was compiled with MEM_PROFILING defined
compresses the help files). compresses the help files).
{not in Vi} {not in Vi}
*:lh* *:lhelpgrep*
:lh[elpgrep] {pattern}[@xx]
Same as ":helpgrep", except the location list is used
instead of the quickfix list. If the help window is
already opened, then the location list for that window
is used. Otherwise, a new help window is opened and
the location list for that window is set. The
location list for the current window is not changed.
*:exu* *:exusage* *:exu* *:exusage*
:exu[sage] Show help on Ex commands. Added to simulate the Nvi :exu[sage] Show help on Ex commands. Added to simulate the Nvi
command. {not in Vi} command. {not in Vi}

View File

@@ -1,4 +1,4 @@
*version7.txt* For Vim version 7.0aa. Last change: 2006 Feb 04 *version7.txt* For Vim version 7.0aa. Last change: 2006 Feb 05
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -192,8 +192,8 @@ Omni completion *new-omni-completion*
This could also be called "intellisense", but that is a trademark. It is a This could also be called "intellisense", but that is a trademark. It is a
smart kind of completion. The text in front of the cursor is inspected to smart kind of completion. The text in front of the cursor is inspected to
figure out what could be following. This considers struct and class members, figure out what could be following. This may suggest struct and class
unions, etc. members, system functions, etc.
Use CTRL-X CTRL-O in Insert mode to start the completion. |i_CTRL-X_CTRL-O| Use CTRL-X CTRL-O in Insert mode to start the completion. |i_CTRL-X_CTRL-O|
@@ -201,8 +201,11 @@ The 'omnifunc' option is set by filetype plugins to define the function that
figures out the completion. figures out the completion.
Currently supported languages: Currently supported languages:
C |ft-c-omni| C |ft-c-omni|
XHTML |ft-html-omni| (X)HTML with CSS |ft-html-omni|
JavaScript |ft-javascript-omni|
any language wih syntax highligting |ft-syntax-omni|
XML |ft-xml-omni|
When the 'completeopt' option contains "menu" then matches for Insert mode When the 'completeopt' option contains "menu" then matches for Insert mode
completion are displayed in a popup menu. completion are displayed in a popup menu.
@@ -460,7 +463,30 @@ Win32: The ":winpos" command now also works in the console. (Vipin Aravind)
|:lgrepadd| Like |:grepadd| but use the location list. |:lgrepadd| Like |:grepadd| but use the location list.
|:lvimgrep| Like |:vimgrep| but use the location list. |:lvimgrep| Like |:vimgrep| but use the location list.
|:lvimgrepadd| Like |:vimgrepadd| but use the location list. |:lvimgrepadd| Like |:vimgrepadd| but use the location list.
|:lhelpgrep| Like |:helpgrep| but use the location list.
|:lfile| Like |:cfile| but use the location list.
|:lgetfile| Like |:cgetfile| but use the location list.
|:laddfile| Like |:caddfile| but use the location list.
|:lbuffer| Like |:cbuffer| but use the location list.
|:laddbuffer| Like |:caddbuffer| but use the location list. |:laddbuffer| Like |:caddbuffer| but use the location list.
|:lexpr| Like |:cexpr| but use the location list.
|:laddexpr| Like |:caddexpr| but use the location list.
|:ll| Like |:cc| but use the location list.
|:llist| Like |:clist| but use the location list.
|:lnext| Like |:cnext| but use the location list.
|:lprev| Like |:cprev| but use the location list.
|:lNext| Like |:cNext| but use the location list.
|:lfirst| Like |:cfirst| but use the location list.
|:lrewind| Like |:crewind| but use the location list.
|:llast| Like |:clast| but use the location list.
|:lnfile| Like |:cnfile| but use the location list.
|:lpfile| Like |:cpfile| but use the location list.
|:lNfile| Like |:cNfile| but use the location list.
|:lolder| Like |:colder| but use the location list.
|:lnewer| Like |:cnewer| but use the location list.
|:lwindow| Like |:cwindow| but use the location list.
|:lopen| Like |:copen| but use the location list.
|:lclose| Like |:cclose| but use the location list.
Ex command modifiers: ~ Ex command modifiers: ~

View File

@@ -1,8 +1,8 @@
" Vim settings file " Vim settings file
" Language: LambdaProlog (Teyjus) " Language: LambdaProlog (Teyjus)
" Maintainer: Markus Mottl <markus@oefai.at> " Maintainer: Markus Mottl <markus.mottl@gmail.com>
" URL: http://www.oefai.at/~markus/vim/ftplugin/lprolog.vim " URL: http://www.ocaml.info/vim/ftplugin/lprolog.vim
" Last Change: 2001 Oct 02 - fixed uncommenting bug (MM) " Last Change: 2006 Feb 05
" 2001 Sep 16 - fixed 'no_mail_maps'-bug (MM) " 2001 Sep 16 - fixed 'no_mail_maps'-bug (MM)
" 2001 Sep 02 - initial release (MM) " 2001 Sep 02 - initial release (MM)

View File

@@ -4,7 +4,7 @@
" Markus Mottl <markus.mottl@gmail.com> " Markus Mottl <markus.mottl@gmail.com>
" Stefano Zacchiroli <zack@bononia.it> " Stefano Zacchiroli <zack@bononia.it>
" URL: http://www.ocaml.info/vim/ftplugin/ocaml.vim " URL: http://www.ocaml.info/vim/ftplugin/ocaml.vim
" Last Change: 2005 Oct 13 - removed GPL; better matchit support (MM, SZ) " Last Change: 2006 Feb 05
" "
" if exists("b:did_ftplugin") " if exists("b:did_ftplugin")
" finish " finish
@@ -377,4 +377,3 @@ let &cpoptions=s:cposet
unlet s:cposet unlet s:cposet
" vim:sw=2 " vim:sw=2

View File

@@ -1,9 +1,9 @@
" Vim syntax file " Vim syntax file
" Language: Dot " Language: Dot
" Filenames: *.dot " Filenames: *.dot
" Maintainer: Markus Mottl <markus@oefai.at> " Maintainer: Markus Mottl <markus.mottl@gmail.com>
" URL: http://www.oefai.at/~markus/vim/syntax/dot.vim " URL: http://www.ocaml.info/vim/syntax/dot.vim
" Last Change: 2004 Jul 26 " Last Change: 2006 Feb 05
" 2001 May 04 - initial version " 2001 May 04 - initial version
" For version 5.x: Clear all syntax items " For version 5.x: Clear all syntax items

View File

@@ -1,9 +1,9 @@
" Vim syntax file " Vim syntax file
" Language: LambdaProlog (Teyjus) " Language: LambdaProlog (Teyjus)
" Filenames: *.mod *.sig " Filenames: *.mod *.sig
" Maintainer: Markus Mottl <markus@oefai.at> " Maintainer: Markus Mottl <markus.mottl@gmail.com>
" URL: http://www.oefai.at/~markus/vim/syntax/lprolog.vim " URL: http://www.ocaml.info/vim/syntax/lprolog.vim
" Last Change: 2004 Jul 26 " Last Change: 2006 Feb 05
" 2001 Apr 26 - Upgraded for new Vim version " 2001 Apr 26 - Upgraded for new Vim version
" 2000 Jun 5 - Initial release " 2000 Jun 5 - Initial release

View File

@@ -2,8 +2,8 @@
" Language: shell (sh) Korn shell (ksh) bash (sh) " Language: shell (sh) Korn shell (ksh) bash (sh)
" Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz> " Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz>
" Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int> " Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int>
" Last Change: Dec 29, 2005 " Last Change: Feb 01, 2006
" Version: 79 " Version: 80
" URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax " URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax
" "
" Using the following VIM variables: {{{1 " Using the following VIM variables: {{{1
@@ -173,7 +173,7 @@ syn match shComma contained ","
" ==== " ====
syn match shCaseBar contained skipwhite "[^|"`'()]\{-}|"hs=e nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote syn match shCaseBar contained skipwhite "[^|"`'()]\{-}|"hs=e nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote
syn match shCaseStart contained skipwhite skipnl "(" nextgroup=shCase,shCaseBar syn match shCaseStart contained skipwhite skipnl "(" nextgroup=shCase,shCaseBar
syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="[^#$()]\{-})"ms=s,hs=e end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,,shComment syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="[^#$()'"]\{-})"ms=s,hs=e end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment
syn region shCaseEsac matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList syn region shCaseEsac matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList
syn keyword shCaseIn contained skipwhite skipnl in nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote syn keyword shCaseIn contained skipwhite skipnl in nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote
if exists("b:is_bash") if exists("b:is_bash")
@@ -181,7 +181,7 @@ if exists("b:is_bash")
else else
syn region shCaseExSingleQuote matchgroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained syn region shCaseExSingleQuote matchgroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained
endif endif
syn region shCaseSingleQuote matchgroup=shOperator start=+'+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained syn region shCaseSingleQuote matchgroup=shOperator start=+'+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained
syn region shCaseDoubleQuote matchgroup=shOperator start=+"+ skip=+\\\\\|\\.+ end=+"+ contains=@shDblQuoteList,shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained syn region shCaseDoubleQuote matchgroup=shOperator start=+"+ skip=+\\\\\|\\.+ end=+"+ contains=@shDblQuoteList,shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained
syn region shCaseCommandSub start=+`+ skip=+\\\\\|\\.+ end=+`+ contains=@shCommandSubList skipwhite skipnl nextgroup=shCaseBar contained syn region shCaseCommandSub start=+`+ skip=+\\\\\|\\.+ end=+`+ contains=@shCommandSubList skipwhite skipnl nextgroup=shCaseBar contained

View File

@@ -1,10 +1,10 @@
" Vim syntax file " Vim syntax file
" Language: SML " Language: SML
" Filenames: *.sml *.sig " Filenames: *.sml *.sig
" Maintainers: Markus Mottl <markus@oefai.at> " Maintainers: Markus Mottl <markus.mottl@gmail.com>
" Fabrizio Zeno Cornelli <zeno@filibusta.crema.unimi.it> " Fabrizio Zeno Cornelli <zeno@filibusta.crema.unimi.it>
" URL: http://www.oefai.at/~markus/vim/syntax/sml.vim " URL: http://www.ocaml.info/vim/syntax/sml.vim
" Last Change: 2004 Jul 26 " Last Change: 2006 Feb 05
" 2001 Nov 20 - Fixed small highlighting bug with modules (MM) " 2001 Nov 20 - Fixed small highlighting bug with modules (MM)
" 2001 Aug 29 - Fixed small highlighting bug (MM) " 2001 Aug 29 - Fixed small highlighting bug (MM)

View File

@@ -1,8 +1,8 @@
" Vim syntax file " Vim syntax file
" Language: Vim 7.0 script " Language: Vim 7.0 script
" Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz> " Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz>
" Last Change: January 30, 2006 " Last Change: February 07, 2006
" Version: 7.0-23 " Version: 7.0-25
" Automatically generated keyword lists: {{{1 " Automatically generated keyword lists: {{{1
" Quit when a syntax file was already loaded {{{2 " Quit when a syntax file was already loaded {{{2
@@ -16,7 +16,7 @@ syn keyword vimTodo contained COMBAK NOT RELEASED TODO WIP
syn cluster vimCommentGroup contains=vimTodo,@Spell syn cluster vimCommentGroup contains=vimTodo,@Spell
" regular vim commands {{{2 " regular vim commands {{{2
syn keyword vimCommand contained ab[breviate] abc[lear] abo[veleft] al[l] arga[dd] argd[elete] argdo arge[dit] argg[lobal] argl[ocal] ar[gs] argu[ment] as[cii] bad[d] ba[ll] bd[elete] be bel[owright] bf[irst] bl[ast] bm[odified] bn[ext] bN[ext] bo[tright] bp[revious] brea[k] breaka[dd] breakd[el] breakl[ist] br[ewind] bro[wse] bufdo b[uffer] buffers bun[load] bw[ipeout] ca[bbrev] cabc[lear] cad[dexpr] caddf[ile] cal[l] cat[ch] cb[uffer] cc ccl[ose] cd ce[nter] cex[pr] cf[ile] cfir[st] cg[etfile] c[hange] changes chd[ir] che[ckpath] checkt[ime] cla[st] cl[ist] clo[se] cmapc[lear] cnew[er] cn[ext] cN[ext] cnf[ile] cNf[ile] cnorea[bbrev] col[der] colo[rscheme] comc[lear] comp[iler] conf[irm] con[tinue] cope[n] co[py] cpf[ile] cp[revious] cq[uit] cr[ewind] cuna[bbrev] cu[nmap] cw[indow] debugg[reedy] delc[ommand] d[elete] DeleteFirst delf[unction] delm[arks] diffg[et] diffoff diffpatch diffpu[t] diffsplit diffthis diffu[pdate] dig[raphs] di[splay] dj[ump] dl[ist] dr[op] ds[earch] dsp[lit] echoe[rr] echom[sg] echon e[dit] el[se] elsei[f] em[enu] emenu* endfo[r] endf[unction] en[dif] endt[ry] endw[hile] ene[w] ex exi[t] Explore exu[sage] f[ile] files filetype fina[lly] fin[d] fini[sh] fir[st] fix[del] fo[ld] foldc[lose] folddoc[losed] foldd[oopen] foldo[pen] for fu[nction] g[lobal] go[to] gr[ep] grepa[dd] ha[rdcopy] h[elp] helpf[ind] helpg[rep] helpt[ags] Hexplore hid[e] his[tory] I ia[bbrev] iabc[lear] if ij[ump] il[ist] imapc[lear] inorea[bbrev] is[earch] isp[lit] iuna[bbrev] iu[nmap] j[oin] ju[mps] k keepalt keepj[umps] kee[pmarks] lad[dexpr] laddf[ile] lan[guage] la[st] lb[uffer] lc[d] lch[dir] lcl[ose] le[ft] lefta[bove] lex[pr] lf[ile] lfir[st] lg[etfile] l[ist] ll lla[st] lli[st] lm[ap] lmapc[lear] lnew[er] lne[xt] lN[ext] lnf[ile] lNf[ile] ln[oremap] lo[adview] loc[kmarks] lockv[ar] lol[der] lop[en] lpf[ile] lp[revious] lr[ewind] ls lu[nmap] lw[indow] mak[e] ma[rk] marks mat[ch] menut[ranslate] mk[exrc] mks[ession] mksp[ell] mkvie[w] mkv[imrc] mod[e] m[ove] mzf[ile] mz[scheme] nbkey NetrwSettings new n[ext] N[ext] nmapc[lear] noh[lsearch] norea[bbrev] Nread nu[mber] nun[map] Nw omapc[lear] on[ly] o[pen] opt[ions] ou[nmap] pc[lose] ped[it] pe[rl] perld[o] po[p] popu popu[p] pp[op] pre[serve] prev[ious] p[rint] P[rint] profd[el] prof[ile] prompt promptf[ind] promptr[epl] ps[earch] pta[g] ptf[irst] ptj[ump] ptl[ast] ptn[ext] ptN[ext] ptp[revious] ptr[ewind] pts[elect] pu[t] pw[d] pyf[ile] py[thon] qa[ll] q[uit] quita[ll] r[ead] rec[over] redi[r] red[o] redr[aw] redraws[tatus] reg[isters] res[ize] ret[ab] retu[rn] rew[ind] ri[ght] rightb[elow] rub[y] rubyd[o] rubyf[ile] ru[ntime] rv[iminfo] sal[l] san[dbox] sa[rgument] sav[eas] sba[ll] sbf[irst] sbl[ast] sbm[odified] sbn[ext] sbN[ext] sbp[revious] sbr[ewind] sb[uffer] scripte[ncoding] scrip[tnames] se[t] setf[iletype] setg[lobal] setl[ocal] Sexplore sf[ind] sfir[st] sh[ell] sign sil[ent] sim[alt] sla[st] sl[eep] sm[agic] sn[ext] sN[ext] sni[ff] sno[magic] sor[t] so[urce] spelld[ump] spe[llgood] spellr[epall] spellw[rong] sp[lit] spr[evious] sre[wind] sta[g] startg[replace] star[tinsert] startr[eplace] stj[ump] st[op] stopi[nsert] sts[elect] sun[hide] sus[pend] sv[iew] syncbind t ta[g] tags tc[l] tcld[o] tclf[ile] te[aroff] tf[irst] the th[row] tj[ump] tl[ast] tm tm[enu] tn[ext] tN[ext] to[pleft] tp[revious] tr[ewind] try ts[elect] tu tu[nmenu] una[bbreviate] u[ndo] unh[ide] unlo[ckvar] unm[ap] up[date] verb[ose] ve[rsion] vert[ical] Vexplore v[global] vie[w] vim[grep] vimgrepa[dd] vi[sual] viu[sage] vmapc[lear] vne[w] vs[plit] vu[nmap] wa[ll] wh[ile] winc[md] windo winp[os] win[size] wn[ext] wN[ext] wp[revious] wq wqa[ll] w[rite] ws[verb] wv[iminfo] X xa[ll] x[it] XMLent XMLns y[ank] syn keyword vimCommand contained ab[breviate] abc[lear] abo[veleft] al[l] arga[dd] argd[elete] argdo arge[dit] argg[lobal] argl[ocal] ar[gs] argu[ment] as[cii] bad[d] ba[ll] bd[elete] be bel[owright] bf[irst] bl[ast] bm[odified] bn[ext] bN[ext] bo[tright] bp[revious] brea[k] breaka[dd] breakd[el] breakl[ist] br[ewind] bro[wse] bufdo b[uffer] buffers bun[load] bw[ipeout] ca[bbrev] cabc[lear] caddb[uffer] cad[dexpr] caddf[ile] cal[l] cat[ch] cb[uffer] cc ccl[ose] cd ce[nter] cex[pr] cf[ile] cfir[st] cg[etfile] c[hange] changes chd[ir] che[ckpath] checkt[ime] cla[st] cl[ist] clo[se] cmapc[lear] cnew[er] cn[ext] cN[ext] cnf[ile] cNf[ile] cnorea[bbrev] col[der] colo[rscheme] comc[lear] comp[iler] conf[irm] con[tinue] cope[n] co[py] cpf[ile] cp[revious] cq[uit] cr[ewind] cuna[bbrev] cu[nmap] cw[indow] debugg[reedy] delc[ommand] d[elete] DeleteFirst delf[unction] delm[arks] diffg[et] diffoff diffpatch diffpu[t] diffsplit diffthis diffu[pdate] dig[raphs] di[splay] dj[ump] dl[ist] dr[op] ds[earch] dsp[lit] echoe[rr] echom[sg] echon e[dit] el[se] elsei[f] em[enu] emenu* endfo[r] endf[unction] en[dif] endt[ry] endw[hile] ene[w] ex exi[t] Explore exu[sage] f[ile] files filetype fina[lly] fin[d] fini[sh] fir[st] fix[del] fo[ld] foldc[lose] folddoc[losed] foldd[oopen] foldo[pen] for fu[nction] g[lobal] go[to] gr[ep] grepa[dd] ha[rdcopy] h[elp] helpf[ind] helpg[rep] helpt[ags] Hexplore hid[e] his[tory] I ia[bbrev] iabc[lear] if ij[ump] il[ist] imapc[lear] inorea[bbrev] is[earch] isp[lit] iuna[bbrev] iu[nmap] j[oin] ju[mps] k keepalt keepj[umps] kee[pmarks] laddb[uffer] lad[dexpr] laddf[ile] lan[guage] la[st] lb[uffer] lc[d] lch[dir] lcl[ose] le[ft] lefta[bove] lex[pr] lf[ile] lfir[st] lg[etfile] lgr[ep] lgrepa[dd] l[ist] ll lla[st] lli[st] lmak[e] lm[ap] lmapc[lear] lnew[er] lne[xt] lN[ext] lnf[ile] lNf[ile] ln[oremap] lo[adview] loc[kmarks] lockv[ar] lol[der] lop[en] lpf[ile] lp[revious] lr[ewind] ls lt[ag] lu[nmap] lv[imgrep] lvimgrepa[dd] lw[indow] mak[e] ma[rk] marks mat[ch] menut[ranslate] mk[exrc] mks[ession] mksp[ell] mkvie[w] mkv[imrc] mod[e] m[ove] mzf[ile] mz[scheme] nbkey NetrwSettings new n[ext] N[ext] nmapc[lear] noh[lsearch] norea[bbrev] Nread nu[mber] nun[map] Nw omapc[lear] on[ly] o[pen] opt[ions] ou[nmap] pc[lose] ped[it] pe[rl] perld[o] po[p] popu popu[p] pp[op] pre[serve] prev[ious] p[rint] P[rint] profd[el] prof[ile] prompt promptf[ind] promptr[epl] ps[earch] pta[g] ptf[irst] ptj[ump] ptl[ast] ptn[ext] ptN[ext] ptp[revious] ptr[ewind] pts[elect] pu[t] pw[d] pyf[ile] py[thon] qa[ll] q[uit] quita[ll] r[ead] rec[over] redi[r] red[o] redr[aw] redraws[tatus] reg[isters] res[ize] ret[ab] retu[rn] rew[ind] ri[ght] rightb[elow] rub[y] rubyd[o] rubyf[ile] ru[ntime] rv[iminfo] sal[l] san[dbox] sa[rgument] sav[eas] sba[ll] sbf[irst] sbl[ast] sbm[odified] sbn[ext] sbN[ext] sbp[revious] sbr[ewind] sb[uffer] scripte[ncoding] scrip[tnames] se[t] setf[iletype] setg[lobal] setl[ocal] Sexplore sf[ind] sfir[st] sh[ell] sign sil[ent] sim[alt] sla[st] sl[eep] sm[agic] sn[ext] sN[ext] sni[ff] sno[magic] sor[t] so[urce] spelld[ump] spe[llgood] spellr[epall] spellw[rong] sp[lit] spr[evious] sre[wind] sta[g] startg[replace] star[tinsert] startr[eplace] stj[ump] st[op] stopi[nsert] sts[elect] sun[hide] sus[pend] sv[iew] syncbind t ta[g] tags tc[l] tcld[o] tclf[ile] te[aroff] tf[irst] the th[row] tj[ump] tl[ast] tm tm[enu] tn[ext] tN[ext] to[pleft] tp[revious] tr[ewind] try ts[elect] tu tu[nmenu] una[bbreviate] u[ndo] unh[ide] unlo[ckvar] unm[ap] up[date] verb[ose] ve[rsion] vert[ical] Vexplore v[global] vie[w] vim[grep] vimgrepa[dd] vi[sual] viu[sage] vmapc[lear] vne[w] vs[plit] vu[nmap] wa[ll] wh[ile] winc[md] windo winp[os] win[size] wn[ext] wN[ext] wp[revious] wq wqa[ll] w[rite] ws[verb] wv[iminfo] X xa[ll] x[it] XMLent XMLns y[ank]
syn match vimCommand contained "\<z[-+^.=]" syn match vimCommand contained "\<z[-+^.=]"
" vimOptions are caught only when contained in a vimSet {{{2 " vimOptions are caught only when contained in a vimSet {{{2
@@ -44,7 +44,7 @@ syn keyword vimErrSetting contained hardtabs ht w1200 w300 w9600
" AutoBuf Events {{{2 " AutoBuf Events {{{2
syn case ignore syn case ignore
syn keyword vimAutoEvent contained BufAdd BufCreate BufDelete BufEnter BufFilePost BufFilePre BufHidden BufLeave BufNew BufNewFile BufRead BufReadCmd BufReadPost BufReadPre BufUnload BufWinEnter BufWinLeave BufWipeout BufWrite BufWriteCmd BufWritePost BufWritePre Cmd-event CmdwinEnter CmdwinLeave ColorScheme CursorHold E135 E143 E200 E201 E203 E204 EncodingChanged FileAppendCmd FileAppendPost FileAppendPre FileChangedRO FileChangedShell FileEncoding FileReadCmd FileReadPost FileReadPre FileType FileWriteCmd FileWritePost FileWritePre FilterReadPost FilterReadPre FilterWritePost FilterWritePre FocusGained FocusLost FuncUndefined GUIEnter InsertChange InsertEnter InsertLeave MenuPopup QuickFixCmdPost QuickFixCmdPre RemoteReply SessionLoadPost StdinReadPost StdinReadPre SwapExists Syntax TermChanged TermResponse User UserGettingBored VimEnter VimLeave VimLeavePre WinEnter WinLeave syn keyword vimAutoEvent contained BufAdd BufCreate BufDelete BufEnter BufFilePost BufFilePre BufHidden BufLeave BufNew BufNewFile BufRead BufReadCmd BufReadPost BufReadPre BufUnload BufWinEnter BufWinLeave BufWipeout BufWrite BufWriteCmd BufWritePost BufWritePre Cmd-event CmdwinEnter CmdwinLeave ColorScheme CursorHold E135 E143 E200 E201 E203 E204 EncodingChanged FileAppendCmd FileAppendPost FileAppendPre FileChangedRO FileChangedShell FileEncoding FileReadCmd FileReadPost FileReadPre FileType FileWriteCmd FileWritePost FileWritePre FilterReadPost FilterReadPre FilterWritePost FilterWritePre FocusGained FocusLost FuncUndefined GUIEnter InsertChange InsertEnter InsertLeave MenuPopup QuickFixCmdPost QuickFixCmdPre RemoteReply SessionLoadPost SpellFileMissing StdinReadPost StdinReadPre SwapExists Syntax TermChanged TermResponse User UserGettingBored VimEnter VimLeave VimLeavePre WinEnter WinLeave
" Highlight commonly used Groupnames {{{2 " Highlight commonly used Groupnames {{{2
syn keyword vimGroup contained Comment Constant String Character Number Boolean Float Identifier Function Statement Conditional Repeat Label Operator Keyword Exception PreProc Include Define Macro PreCondit Type StorageClass Structure Typedef Special SpecialChar Tag Delimiter SpecialComment Debug Underlined Ignore Error Todo syn keyword vimGroup contained Comment Constant String Character Number Boolean Float Identifier Function Statement Conditional Repeat Label Operator Keyword Exception PreProc Include Define Macro PreCondit Type StorageClass Structure Typedef Special SpecialChar Tag Delimiter SpecialComment Debug Underlined Ignore Error Todo
@@ -126,7 +126,7 @@ syn keyword vimPattern contained start skip end
syn cluster vimOperGroup contains=vimOper,vimOperParen,vimNumber,vimString,vimOperOk,vimRegister,vimContinue syn cluster vimOperGroup contains=vimOper,vimOperParen,vimNumber,vimString,vimOperOk,vimRegister,vimContinue
syn match vimOper "\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile syn match vimOper "\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile
syn match vimOper "||\|&&\|[-+.]" skipwhite nextgroup=vimString,vimSpecFile syn match vimOper "||\|&&\|[-+.]" skipwhite nextgroup=vimString,vimSpecFile
syn region vimOperParen oneline matchgroup=vimOper start="(" end=")" contains=@vimOperGroup syn region vimOperParen matchgroup=vimOper start="(" end=")" contains=@vimOperGroup
syn region vimOperParen matchgroup=vimSep start="{" end="}" contains=@vimOperGroup nextgroup=vimVar syn region vimOperParen matchgroup=vimSep start="{" end="}" contains=@vimOperGroup nextgroup=vimVar
syn match vimOperOk "\<[aiAIrR][()]" syn match vimOperOk "\<[aiAIrR][()]"
if !exists("g:vimsyntax_noerror") if !exists("g:vimsyntax_noerror")
@@ -185,7 +185,6 @@ syn match vimEnvvar "\${\I\i*}"
" In-String Specials: {{{2 " In-String Specials: {{{2
" Try to catch strings, if nothing else matches (therefore it must precede the others!) " Try to catch strings, if nothing else matches (therefore it must precede the others!)
" vimEscapeBrace handles ["] []"] (ie. "s don't terminate string inside []) " vimEscapeBrace handles ["] []"] (ie. "s don't terminate string inside [])
" COMBAK: I don't know why the \ze is needed in vimPatSepZone
syn region vimEscapeBrace oneline contained transparent start="[^\\]\(\\\\\)*\[\^\=\]\=" skip="\\\\\|\\\]" end="\]"me=e-1 syn region vimEscapeBrace oneline contained transparent start="[^\\]\(\\\\\)*\[\^\=\]\=" skip="\\\\\|\\\]" end="\]"me=e-1
syn match vimPatSepErr contained "\\)" syn match vimPatSepErr contained "\\)"
syn match vimPatSep contained "\\|" syn match vimPatSep contained "\\|"
@@ -194,7 +193,7 @@ syn region vimPatRegion contained transparent matchgroup=vimPatSepR start="\\[z%
syn match vimNotPatSep contained "\\\\" syn match vimNotPatSep contained "\\\\"
syn cluster vimStringGroup contains=vimEscapeBrace,vimPatSep,vimNotPatSep,vimPatSepErr,vimPatSepZone syn cluster vimStringGroup contains=vimEscapeBrace,vimPatSep,vimNotPatSep,vimPatSepErr,vimPatSepZone
syn region vimString oneline keepend start=+[^:a-zA-Z>!\\@]"+lc=1 skip=+\\\\\|\\"+ end=+"+ contains=@vimStringGroup syn region vimString oneline keepend start=+[^:a-zA-Z>!\\@]"+lc=1 skip=+\\\\\|\\"+ end=+"+ contains=@vimStringGroup
syn region vimString oneline keepend start=+[^:a-zA-Z>!\\@]'+lc=1 end=+'+ contains=@vimStringGroup syn region vimString oneline keepend start=+[^:a-zA-Z>!\\@]'+lc=1 end=+'+
syn region vimString oneline start=+=!+lc=1 skip=+\\\\\|\\!+ end=+!+ contains=@vimStringGroup syn region vimString oneline start=+=!+lc=1 skip=+\\\\\|\\!+ end=+!+ contains=@vimStringGroup
syn region vimString oneline start="=+"lc=1 skip="\\\\\|\\+" end="+" contains=@vimStringGroup syn region vimString oneline start="=+"lc=1 skip="\\\\\|\\+" end="+" contains=@vimStringGroup
syn region vimString oneline start="\s/\s*\A"lc=1 skip="\\\\\|\\+" end="/" contains=@vimStringGroup syn region vimString oneline start="\s/\s*\A"lc=1 skip="\\\\\|\\+" end="/" contains=@vimStringGroup
@@ -221,7 +220,7 @@ syn match vimSubstFlagErr contained "[^< \t\r|]\+" contains=vimSubstFlags
syn match vimSubstFlags contained "[&cegiIpr]\+" syn match vimSubstFlags contained "[&cegiIpr]\+"
" 'String': {{{2 " 'String': {{{2
syn match vimString "[^(,]'[^']\{-}'"lc=1 contains=@vimStringGroup syn match vimString "[^(,]'[^']\{-}\zs'"
" Marks, Registers, Addresses, Filters: {{{2 " Marks, Registers, Addresses, Filters: {{{2
syn match vimMark "'[a-zA-Z0-9]\ze[-+,!]" nextgroup=vimOper,vimMarkNumber,vimSubst syn match vimMark "'[a-zA-Z0-9]\ze[-+,!]" nextgroup=vimOper,vimMarkNumber,vimSubst
@@ -249,8 +248,8 @@ syn match vimFilter contained "\A!.\{-}\(|\|$\)"ms=s+1 contains=vimSpecFile
"syn match vimCmplxRepeat '@[0-9a-z".=@:]\ze\($\|[^a-zA-Z]\)' "syn match vimCmplxRepeat '@[0-9a-z".=@:]\ze\($\|[^a-zA-Z]\)'
" Set command and associated set-options (vimOptions) with comment {{{2 " Set command and associated set-options (vimOptions) with comment {{{2
syn region vimSet matchgroup=vimCommand start="\<setlocal\|set\>" end="|"me=e-1 end="$" matchgroup=vimNotation end="<[cC][rR]>" keepend contains=vimSetEqual,vimOption,vimErrSetting,vimComment,vimSetString,vimSetMod syn region vimSet matchgroup=vimCommand start="\<setlocal\|set\>" skip="\%(\\\\\)*\\." end="$" matchgroup=vimNotation end="<[cC][rR]>" keepend oneline contains=vimSetEqual,vimOption,vimErrSetting,vimComment,vimSetString,vimSetMod
syn region vimSetEqual contained start="=" skip="\\\\\|\\\s" end="[| \t]\|$"me=e-1 contains=vimCtrlChar,vimSetSep,vimNotation syn region vimSetEqual contained start="=" skip="\\\\\|\\\s" end="[| \t]\|$"me=e-1 contains=vimCtrlChar,vimSetSep,vimNotation oneline
syn region vimSetString contained start=+="+hs=s+1 skip=+\\\\\|\\"+ end=+"+ contains=vimCtrlChar syn region vimSetString contained start=+="+hs=s+1 skip=+\\\\\|\\"+ end=+"+ contains=vimCtrlChar
syn match vimSetSep contained "[,:]" syn match vimSetSep contained "[,:]"
syn match vimSetMod contained "&vim\|[!&]\|all&" syn match vimSetMod contained "&vim\|[!&]\|all&"

View File

@@ -675,6 +675,8 @@ LINK_PDB = /PDB:$(OUTDIR)/$(VIM).pdb -debug:full -debugtype:cv,fixup
conflags = /nologo /subsystem:$(SUBSYSTEM) /incremental:no conflags = /nologo /subsystem:$(SUBSYSTEM) /incremental:no
PATHDEF_SRC = $(OUTDIR)\pathdef.c
!IF "$(MAP)" == "yes" !IF "$(MAP)" == "yes"
# "/map" is for debugging # "/map" is for debugging
conflags = $(conflags) /map conflags = $(conflags) /map
@@ -736,7 +738,6 @@ notags:
clean: clean:
- if exist $(OUTDIR)/nul $(DEL_TREE) $(OUTDIR) - if exist $(OUTDIR)/nul $(DEL_TREE) $(OUTDIR)
- if exist auto/pathdef.c del auto/pathdef.c
- if exist *.obj del *.obj - if exist *.obj del *.obj
- if exist $(VIM).exe del $(VIM).exe - if exist $(VIM).exe del $(VIM).exe
- if exist $(VIM).ilk del $(VIM).ilk - if exist $(VIM).ilk del $(VIM).ilk
@@ -894,8 +895,8 @@ $(OUTDIR)/os_win32.obj: $(OUTDIR) os_win32.c $(INCL) os_win32.h
$(OUTDIR)/os_w32exe.obj: $(OUTDIR) os_w32exe.c $(INCL) $(OUTDIR)/os_w32exe.obj: $(OUTDIR) os_w32exe.c $(INCL)
$(OUTDIR)/pathdef.obj: $(OUTDIR) auto/pathdef.c $(INCL) $(OUTDIR)/pathdef.obj: $(OUTDIR) $(PATHDEF_SRC) $(INCL)
$(CC) $(CFLAGS) auto/pathdef.c $(CC) $(CFLAGS) $(PATHDEF_SRC)
$(OUTDIR)/popupmenu.obj: $(OUTDIR) popupmenu.c $(INCL) $(OUTDIR)/popupmenu.obj: $(OUTDIR) popupmenu.c $(INCL)
@@ -943,16 +944,16 @@ $(OUTDIR)/glbl_ime.obj: $(OUTDIR) glbl_ime.cpp dimm.h $(INCL)
E0_CFLAGS = $(CFLAGS:\=\\) E0_CFLAGS = $(CFLAGS:\=\\)
E_CFLAGS = $(E0_CFLAGS:"=\") E_CFLAGS = $(E0_CFLAGS:"=\")
auto/pathdef.c: auto $(PATHDEF_SRC): auto
@echo creating auto/pathdef.c @echo creating $(PATHDEF_SRC)
@echo /* pathdef.c */ > auto\pathdef.c @echo /* pathdef.c */ > $(PATHDEF_SRC)
@echo #include "vim.h" >> auto\pathdef.c @echo #include "vim.h" >> $(PATHDEF_SRC)
@echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC:\=\\)"; >> auto\pathdef.c @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC:\=\\)"; >> $(PATHDEF_SRC)
@echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR:\=\\)"; >> auto\pathdef.c @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR:\=\\)"; >> $(PATHDEF_SRC)
@echo char_u *all_cflags = (char_u *)"$(CC:\=\\) $(E_CFLAGS)"; >> auto\pathdef.c @echo char_u *all_cflags = (char_u *)"$(CC:\=\\) $(E_CFLAGS)"; >> $(PATHDEF_SRC)
@echo char_u *all_lflags = (char_u *)"$(link:\=\\) $(LINKARGS1:\=\\) $(LINKARGS2:\=\\)"; >> auto\pathdef.c @echo char_u *all_lflags = (char_u *)"$(link:\=\\) $(LINKARGS1:\=\\) $(LINKARGS2:\=\\)"; >> $(PATHDEF_SRC)
@echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> auto\pathdef.c @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> $(PATHDEF_SRC)
@echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> auto\pathdef.c @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> $(PATHDEF_SRC)
auto: auto:
if not exist auto/nul mkdir auto if not exist auto/nul mkdir auto

View File

@@ -68,7 +68,11 @@ struct Completion
compl_T *cp_next; compl_T *cp_next;
compl_T *cp_prev; compl_T *cp_prev;
char_u *cp_str; /* matched text */ char_u *cp_str; /* matched text */
char_u *cp_fname; /* file containing the match */ char_u *cp_extra; /* extra menu text (allocated, can be NULL) */
char_u *cp_info; /* verbose info (can be NULL) */
char_u cp_kind; /* kind of match, single letter, or NUL */
char_u *cp_fname; /* file containing the match, allocated when
* cp_flags has FREE_FNAME */
int cp_flags; /* ORIGINAL_TEXT, CONT_S_IPOS or FREE_FNAME */ int cp_flags; /* ORIGINAL_TEXT, CONT_S_IPOS or FREE_FNAME */
int cp_number; /* sequence number */ int cp_number; /* sequence number */
}; };
@@ -115,20 +119,21 @@ static expand_T compl_xp;
static void ins_ctrl_x __ARGS((void)); static void ins_ctrl_x __ARGS((void));
static int has_compl_option __ARGS((int dict_opt)); static int has_compl_option __ARGS((int dict_opt));
static void ins_compl_add_matches __ARGS((int num_matches, char_u **matches, int dir)); static void ins_compl_add_matches __ARGS((int num_matches, char_u **matches));
static int ins_compl_make_cyclic __ARGS((void)); static int ins_compl_make_cyclic __ARGS((void));
static void ins_compl_upd_pum __ARGS((void)); static void ins_compl_upd_pum __ARGS((void));
static void ins_compl_del_pum __ARGS((void)); static void ins_compl_del_pum __ARGS((void));
static int pum_wanted __ARGS((void)); static int pum_wanted __ARGS((void));
static int pum_two_or_more __ARGS((void)); static int pum_two_or_more __ARGS((void));
static void ins_compl_dictionaries __ARGS((char_u *dict, char_u *pat, int dir, int flags, int thesaurus)); static void ins_compl_dictionaries __ARGS((char_u *dict, char_u *pat, int flags, int thesaurus));
static void ins_compl_free __ARGS((void)); static void ins_compl_free __ARGS((void));
static void ins_compl_clear __ARGS((void)); static void ins_compl_clear __ARGS((void));
static int ins_compl_bs __ARGS((void)); static int ins_compl_bs __ARGS((void));
static void ins_compl_addleader __ARGS((int c)); static void ins_compl_addleader __ARGS((int c));
static void ins_compl_addfrommatch __ARGS((void));
static int ins_compl_prep __ARGS((int c)); static int ins_compl_prep __ARGS((int c));
static buf_T *ins_compl_next_buf __ARGS((buf_T *buf, int flag)); static buf_T *ins_compl_next_buf __ARGS((buf_T *buf, int flag));
static int ins_compl_get_exp __ARGS((pos_T *ini, int dir)); static int ins_compl_get_exp __ARGS((pos_T *ini));
static void ins_compl_delete __ARGS((void)); static void ins_compl_delete __ARGS((void));
static void ins_compl_insert __ARGS((void)); static void ins_compl_insert __ARGS((void));
static int ins_compl_next __ARGS((int allow_get_expansion, int count)); static int ins_compl_next __ARGS((int allow_get_expansion, int count));
@@ -684,19 +689,34 @@ edit(cmdchar, startln, count)
if (c == K_DOWN && pum_visible()) if (c == K_DOWN && pum_visible())
c = Ctrl_N; c = Ctrl_N;
/* When using BS while the popup menu is wanted and still after the /*
* character where completion started: Change the subset of matches to * Special handling of keys while the popup menu is visible or wanted
* what matches "compl_leader". */ * and the cursor is still in the completed word.
if (compl_started && pum_wanted() && curwin->w_cursor.col > compl_col) */
if (compl_started && pum_wanted() && curwin->w_cursor.col >= compl_col)
{ {
if ((c == K_BS || c == Ctrl_H) && ins_compl_bs()) /* BS: Delete one character from "compl_leader". */
if ((c == K_BS || c == Ctrl_H)
&& curwin->w_cursor.col > compl_col && ins_compl_bs())
continue; continue;
/* Editing the word. */ /* When no match was selected or it was edited. */
if (!compl_used_match && vim_isprintc(c)) if (!compl_used_match)
{ {
ins_compl_addleader(c); /* CTRL-L: Add one character from the current match to
continue; * "compl_leader". */
if (c == Ctrl_L)
{
ins_compl_addfrommatch();
continue;
}
/* A printable character: Add it to "compl_leader". */
if (vim_isprintc(c))
{
ins_compl_addleader(c);
continue;
}
} }
} }
@@ -1922,7 +1942,7 @@ vim_is_ctrl_x_key(c)
} }
/* /*
* This is like ins_compl_add(), but if ic and inf are set, then the * This is like ins_compl_add(), but if 'ic' and 'inf' are set, then the
* case of the originally typed text is used, and the case of the completed * case of the originally typed text is used, and the case of the completed
* text is infered, ie this tries to work out what case you probably wanted * text is infered, ie this tries to work out what case you probably wanted
* the rest of the word to be in -- webb * the rest of the word to be in -- webb
@@ -1985,9 +2005,9 @@ ins_compl_add_infercase(str, len, fname, dir, flags)
/* Copy the original case of the part we typed */ /* Copy the original case of the part we typed */
STRNCPY(IObuff, compl_orig_text, compl_length); STRNCPY(IObuff, compl_orig_text, compl_length);
return ins_compl_add(IObuff, len, fname, dir, flags); return ins_compl_add(IObuff, len, fname, NULL, dir, flags);
} }
return ins_compl_add(str, len, fname, dir, flags); return ins_compl_add(str, len, fname, NULL, dir, flags);
} }
/* /*
@@ -2002,14 +2022,16 @@ ins_compl_add_infercase(str, len, fname, dir, flags)
* maybe because alloc() returns NULL, then FAIL is returned -- webb. * maybe because alloc() returns NULL, then FAIL is returned -- webb.
*/ */
int int
ins_compl_add(str, len, fname, dir, flags) ins_compl_add(str, len, fname, extra, cdir, flags)
char_u *str; char_u *str;
int len; int len;
char_u *fname; char_u *fname;
int dir; char_u *extra; /* extra text for popup menu or NULL */
int cdir;
int flags; int flags;
{ {
compl_T *match; compl_T *match;
int dir = (cdir == 0 ? compl_direction : cdir);
ui_breakcheck(); ui_breakcheck();
if (got_int) if (got_int)
@@ -2040,7 +2062,7 @@ ins_compl_add(str, len, fname, dir, flags)
* Allocate a new match structure. * Allocate a new match structure.
* Copy the values to the new match structure. * Copy the values to the new match structure.
*/ */
match = (compl_T *)alloc((unsigned)sizeof(compl_T)); match = (compl_T *)alloc_clear((unsigned)sizeof(compl_T));
if (match == NULL) if (match == NULL)
return FAIL; return FAIL;
match->cp_number = -1; match->cp_number = -1;
@@ -2054,18 +2076,26 @@ ins_compl_add(str, len, fname, dir, flags)
vim_free(match); vim_free(match);
return FAIL; return FAIL;
} }
/* match-fname is: /* match-fname is:
* - compl_curr_match->cp_fname if it is a string equal to fname. * - compl_curr_match->cp_fname if it is a string equal to fname.
* - a copy of fname, FREE_FNAME is set to free later THE allocated mem. * - a copy of fname, FREE_FNAME is set to free later THE allocated mem.
* - NULL otherwise. --Acevedo */ * - NULL otherwise. --Acevedo */
if (fname && compl_curr_match && compl_curr_match->cp_fname if (fname != NULL
&& STRCMP(fname, compl_curr_match->cp_fname) == 0) && compl_curr_match
&& compl_curr_match->cp_fname != NULL
&& STRCMP(fname, compl_curr_match->cp_fname) == 0)
match->cp_fname = compl_curr_match->cp_fname; match->cp_fname = compl_curr_match->cp_fname;
else if (fname && (match->cp_fname = vim_strsave(fname)) != NULL) else if (fname != NULL)
{
match->cp_fname = vim_strsave(fname);
flags |= FREE_FNAME; flags |= FREE_FNAME;
}
else else
match->cp_fname = NULL; match->cp_fname = NULL;
match->cp_flags = flags; match->cp_flags = flags;
if (extra != NULL)
match->cp_extra = vim_strsave(extra);
/* /*
* Link the new match structure in the list of matches. * Link the new match structure in the list of matches.
@@ -2098,19 +2128,18 @@ ins_compl_add(str, len, fname, dir, flags)
* Frees matches[]. * Frees matches[].
*/ */
static void static void
ins_compl_add_matches(num_matches, matches, dir) ins_compl_add_matches(num_matches, matches)
int num_matches; int num_matches;
char_u **matches; char_u **matches;
int dir;
{ {
int i; int i;
int add_r = OK; int add_r = OK;
int ldir = dir; int dir = compl_direction;
for (i = 0; i < num_matches && add_r != FAIL; i++) for (i = 0; i < num_matches && add_r != FAIL; i++)
if ((add_r = ins_compl_add(matches[i], -1, NULL, ldir, 0)) == OK) if ((add_r = ins_compl_add(matches[i], -1, NULL, NULL, dir, 0)) == OK)
/* if dir was BACKWARD then honor it just once */ /* if dir was BACKWARD then honor it just once */
ldir = FORWARD; dir = FORWARD;
FreeWild(num_matches, matches); FreeWild(num_matches, matches);
} }
@@ -2143,7 +2172,7 @@ ins_compl_make_cyclic()
/* "compl_match_array" points the currently displayed list of entries in the /* "compl_match_array" points the currently displayed list of entries in the
* popup menu. It is NULL when there is no popup menu. */ * popup menu. It is NULL when there is no popup menu. */
static char_u **compl_match_array = NULL; static pumitem_T *compl_match_array = NULL;
static int compl_match_arraysize; static int compl_match_arraysize;
/* /*
@@ -2223,11 +2252,15 @@ pum_two_or_more()
/* /*
* Show the popup menu for the list of matches. * Show the popup menu for the list of matches.
* Also adjusts "compl_shown_match" to an entry that is actually displayed.
*/ */
void void
ins_compl_show_pum() ins_compl_show_pum()
{ {
compl_T *compl; compl_T *compl;
compl_T *shown_compl = NULL;
int did_find_shown_match = FALSE;
int shown_match_ok = FALSE;
int i; int i;
int cur = -1; int cur = -1;
colnr_T col; colnr_T col;
@@ -2256,7 +2289,8 @@ ins_compl_show_pum()
} while (compl != NULL && compl != compl_first_match); } while (compl != NULL && compl != compl_first_match);
if (compl_match_arraysize == 0) if (compl_match_arraysize == 0)
return; return;
compl_match_array = (char_u **)alloc((unsigned)(sizeof(char_u **) compl_match_array = (pumitem_T *)alloc_clear(
(unsigned)(sizeof(pumitem_T)
* compl_match_arraysize)); * compl_match_arraysize));
if (compl_match_array != NULL) if (compl_match_array != NULL)
{ {
@@ -2269,19 +2303,52 @@ ins_compl_show_pum()
|| STRNCMP(compl->cp_str, compl_leader, || STRNCMP(compl->cp_str, compl_leader,
lead_len) == 0)) lead_len) == 0))
{ {
if (compl == compl_shown_match) if (!shown_match_ok)
{
if (compl == compl_shown_match || did_find_shown_match)
{
/* This item is the shown match or this is the
* first displayed item after the shown match. */
compl_shown_match = compl;
did_find_shown_match = TRUE;
shown_match_ok = TRUE;
}
else
/* Remember this displayed match for when the
* shown match is just below it. */
shown_compl = compl;
cur = i; cur = i;
compl_match_array[i++] = compl->cp_str; }
compl_match_array[i].pum_text = compl->cp_str;
if (compl->cp_extra != NULL)
compl_match_array[i++].pum_extra = compl->cp_extra;
else
compl_match_array[i++].pum_extra = compl->cp_fname;
}
if (compl == compl_shown_match)
{
did_find_shown_match = TRUE;
if (!shown_match_ok && shown_compl != NULL)
{
/* The shown match isn't displayed, set it to the
* previously displayed match. */
compl_shown_match = shown_compl;
shown_match_ok = TRUE;
}
} }
compl = compl->cp_next; compl = compl->cp_next;
} while (compl != NULL && compl != compl_first_match); } while (compl != NULL && compl != compl_first_match);
if (!shown_match_ok) /* no displayed match at all */
cur = -1;
} }
} }
else else
{ {
/* popup menu already exists, only need to find the current item.*/ /* popup menu already exists, only need to find the current item.*/
for (i = 0; i < compl_match_arraysize; ++i) for (i = 0; i < compl_match_arraysize; ++i)
if (compl_match_array[i] == compl_shown_match->cp_str) if (compl_match_array[i].pum_text == compl_shown_match->cp_str)
break; break;
cur = i; cur = i;
} }
@@ -2309,10 +2376,9 @@ ins_compl_show_pum()
* completions. * completions.
*/ */
static void static void
ins_compl_dictionaries(dict, pat, dir, flags, thesaurus) ins_compl_dictionaries(dict, pat, flags, thesaurus)
char_u *dict; char_u *dict;
char_u *pat; char_u *pat;
int dir;
int flags; int flags;
int thesaurus; int thesaurus;
{ {
@@ -2325,6 +2391,7 @@ ins_compl_dictionaries(dict, pat, dir, flags, thesaurus)
int count; int count;
int i; int i;
int save_p_scs; int save_p_scs;
int dir = compl_direction;
buf = alloc(LSIZE); buf = alloc(LSIZE);
/* If 'infercase' is set, don't use 'smartcase' here */ /* If 'infercase' is set, don't use 'smartcase' here */
@@ -2521,6 +2588,7 @@ ins_compl_free()
/* several entries may use the same fname, free it just once. */ /* several entries may use the same fname, free it just once. */
if (match->cp_flags & FREE_FNAME) if (match->cp_flags & FREE_FNAME)
vim_free(match->cp_fname); vim_free(match->cp_fname);
vim_free(match->cp_extra);
vim_free(match); vim_free(match);
} while (compl_curr_match != NULL && compl_curr_match != compl_first_match); } while (compl_curr_match != NULL && compl_curr_match != compl_first_match);
compl_first_match = compl_curr_match = NULL; compl_first_match = compl_curr_match = NULL;
@@ -2541,8 +2609,8 @@ ins_compl_clear()
} }
/* /*
* Delete one character before the cursor and make a subset of the matches * Delete one character before the cursor and show the subset of the matches
* that match now. * that match the word that is now before the cursor.
* Returns TRUE if the work is done and another char to be got from the user. * Returns TRUE if the work is done and another char to be got from the user.
*/ */
static int static int
@@ -2629,6 +2697,29 @@ ins_compl_addleader(c)
} }
} }
/*
* Append one character to the match leader. May reduce the number of
* matches.
*/
static void
ins_compl_addfrommatch()
{
char_u *p;
int len = curwin->w_cursor.col - compl_col;
int c;
p = compl_shown_match->cp_str;
if (STRLEN(p) <= len) /* the match is too short */
return;
p += len;
#ifdef FEAT_MBYTE
c = mb_ptr2char(p);
#else
c = *p;
#endif
ins_compl_addleader(c);
}
/* /*
* Prepare for Insert mode completion, or stop it. * Prepare for Insert mode completion, or stop it.
* Called just after typing a character in Insert mode. * Called just after typing a character in Insert mode.
@@ -2919,30 +3010,30 @@ ins_compl_next_buf(buf, flag)
} }
#ifdef FEAT_COMPL_FUNC #ifdef FEAT_COMPL_FUNC
static int expand_by_function __ARGS((int type, char_u *base, char_u ***matches)); static void expand_by_function __ARGS((int type, char_u *base));
/* /*
* Execute user defined complete function 'completefunc' or 'omnifunc', and * Execute user defined complete function 'completefunc' or 'omnifunc', and
* get matches in "matches". * get matches in "matches".
* Return value is number of matches. * Return value is number of matches.
*/ */
static int static void
expand_by_function(type, base, matches) expand_by_function(type, base)
int type; /* CTRL_X_OMNI or CTRL_X_FUNCTION */ int type; /* CTRL_X_OMNI or CTRL_X_FUNCTION */
char_u *base; char_u *base;
char_u ***matches;
{ {
list_T *matchlist; list_T *matchlist;
char_u *args[2]; char_u *args[2];
listitem_T *li; listitem_T *li;
garray_T ga;
char_u *p; char_u *p;
char_u *funcname; char_u *funcname;
pos_T pos; pos_T pos;
int dir = compl_direction;
char_u *x;
funcname = (type == CTRL_X_FUNCTION) ? curbuf->b_p_cfu : curbuf->b_p_ofu; funcname = (type == CTRL_X_FUNCTION) ? curbuf->b_p_cfu : curbuf->b_p_ofu;
if (*funcname == NUL) if (*funcname == NUL)
return 0; return;
/* Call 'completefunc' to obtain the list of matches. */ /* Call 'completefunc' to obtain the list of matches. */
args[0] = (char_u *)"0"; args[0] = (char_u *)"0";
@@ -2952,42 +3043,47 @@ expand_by_function(type, base, matches)
matchlist = call_func_retlist(funcname, 2, args, FALSE); matchlist = call_func_retlist(funcname, 2, args, FALSE);
curwin->w_cursor = pos; /* restore the cursor position */ curwin->w_cursor = pos; /* restore the cursor position */
if (matchlist == NULL) if (matchlist == NULL)
return 0; return;
/* Go through the List with matches and put them in an array. */ /* Go through the List with matches and add each of them. */
ga_init2(&ga, (int)sizeof(char_u *), 8);
for (li = matchlist->lv_first; li != NULL; li = li->li_next) for (li = matchlist->lv_first; li != NULL; li = li->li_next)
{ {
p = get_tv_string_chk(&li->li_tv); if (li->li_tv.v_type == VAR_DICT && li->li_tv.vval.v_dict != NULL)
{
p = get_dict_string(li->li_tv.vval.v_dict, (char_u *)"word", FALSE);
x = get_dict_string(li->li_tv.vval.v_dict, (char_u *)"menu", FALSE);
}
else
{
p = get_tv_string_chk(&li->li_tv);
x = NULL;
}
if (p != NULL && *p != NUL) if (p != NULL && *p != NUL)
{ {
if (ga_grow(&ga, 1) == FAIL) if (ins_compl_add(p, -1, NULL, x, dir, 0) == OK)
break; /* if dir was BACKWARD then honor it just once */
((char_u **)ga.ga_data)[ga.ga_len] = vim_strsave(p); dir = FORWARD;
++ga.ga_len;
} }
else if (did_emsg) else if (did_emsg)
break; break;
} }
list_unref(matchlist); list_unref(matchlist);
*matches = (char_u **)ga.ga_data;
return ga.ga_len;
} }
#endif /* FEAT_COMPL_FUNC */ #endif /* FEAT_COMPL_FUNC */
/* /*
* Get the next expansion(s), using "compl_pattern". * Get the next expansion(s), using "compl_pattern".
* The search starts at position "ini" in curbuf and in the direction dir. * The search starts at position "ini" in curbuf and in the direction
* compl_direction.
* When "compl_started" is FALSE start at that position, otherwise * When "compl_started" is FALSE start at that position, otherwise
* continue where we stopped searching before. * continue where we stopped searching before.
* This may return before finding all the matches. * This may return before finding all the matches.
* Return the total number of matches or -1 if still unknown -- Acevedo * Return the total number of matches or -1 if still unknown -- Acevedo
*/ */
static int static int
ins_compl_get_exp(ini, dir) ins_compl_get_exp(ini)
pos_T *ini; pos_T *ini;
int dir;
{ {
static pos_T first_match_pos; static pos_T first_match_pos;
static pos_T last_match_pos; static pos_T last_match_pos;
@@ -3023,7 +3119,7 @@ ins_compl_get_exp(ini, dir)
} }
old_match = compl_curr_match; /* remember the last current match */ old_match = compl_curr_match; /* remember the last current match */
pos = (dir == FORWARD) ? &last_match_pos : &first_match_pos; pos = (compl_direction == FORWARD) ? &last_match_pos : &first_match_pos;
/* For ^N/^P loop over all the flags/windows/buffers in 'complete' */ /* For ^N/^P loop over all the flags/windows/buffers in 'complete' */
for (;;) for (;;)
{ {
@@ -3126,7 +3222,7 @@ ins_compl_get_exp(ini, dir)
#ifdef FEAT_FIND_ID #ifdef FEAT_FIND_ID
case CTRL_X_PATH_PATTERNS: case CTRL_X_PATH_PATTERNS:
case CTRL_X_PATH_DEFINES: case CTRL_X_PATH_DEFINES:
find_pattern_in_path(compl_pattern, dir, find_pattern_in_path(compl_pattern, compl_direction,
(int)STRLEN(compl_pattern), FALSE, FALSE, (int)STRLEN(compl_pattern), FALSE, FALSE,
(type == CTRL_X_PATH_DEFINES (type == CTRL_X_PATH_DEFINES
&& !(compl_cont_status & CONT_SOL)) && !(compl_cont_status & CONT_SOL))
@@ -3146,7 +3242,7 @@ ins_compl_get_exp(ini, dir)
: (*curbuf->b_p_dict == NUL : (*curbuf->b_p_dict == NUL
? p_dict ? p_dict
: curbuf->b_p_dict)), : curbuf->b_p_dict)),
compl_pattern, dir, compl_pattern,
dict ? dict_f : 0, type == CTRL_X_THESAURUS); dict ? dict_f : 0, type == CTRL_X_THESAURUS);
dict = NULL; dict = NULL;
break; break;
@@ -3163,7 +3259,7 @@ ins_compl_get_exp(ini, dir)
TAG_INS_COMP | (ctrl_x_mode ? TAG_VERBOSE : 0), TAG_INS_COMP | (ctrl_x_mode ? TAG_VERBOSE : 0),
TAG_MANY, curbuf->b_ffname) == OK && num_matches > 0) TAG_MANY, curbuf->b_ffname) == OK && num_matches > 0)
{ {
ins_compl_add_matches(num_matches, matches, dir); ins_compl_add_matches(num_matches, matches);
} }
p_ic = save_p_ic; p_ic = save_p_ic;
break; break;
@@ -3175,7 +3271,7 @@ ins_compl_get_exp(ini, dir)
/* May change home directory back to "~". */ /* May change home directory back to "~". */
tilde_replace(compl_pattern, num_matches, matches); tilde_replace(compl_pattern, num_matches, matches);
ins_compl_add_matches(num_matches, matches, dir); ins_compl_add_matches(num_matches, matches);
} }
break; break;
@@ -3183,15 +3279,13 @@ ins_compl_get_exp(ini, dir)
if (expand_cmdline(&compl_xp, compl_pattern, if (expand_cmdline(&compl_xp, compl_pattern,
(int)STRLEN(compl_pattern), (int)STRLEN(compl_pattern),
&num_matches, &matches) == EXPAND_OK) &num_matches, &matches) == EXPAND_OK)
ins_compl_add_matches(num_matches, matches, dir); ins_compl_add_matches(num_matches, matches);
break; break;
#ifdef FEAT_COMPL_FUNC #ifdef FEAT_COMPL_FUNC
case CTRL_X_FUNCTION: case CTRL_X_FUNCTION:
case CTRL_X_OMNI: case CTRL_X_OMNI:
num_matches = expand_by_function(type, compl_pattern, &matches); expand_by_function(type, compl_pattern);
if (num_matches > 0)
ins_compl_add_matches(num_matches, matches, dir);
break; break;
#endif #endif
@@ -3200,7 +3294,7 @@ ins_compl_get_exp(ini, dir)
num_matches = expand_spelling(first_match_pos.lnum, num_matches = expand_spelling(first_match_pos.lnum,
first_match_pos.col, compl_pattern, &matches); first_match_pos.col, compl_pattern, &matches);
if (num_matches > 0) if (num_matches > 0)
ins_compl_add_matches(num_matches, matches, dir); ins_compl_add_matches(num_matches, matches);
#endif #endif
break; break;
@@ -3230,9 +3324,10 @@ ins_compl_get_exp(ini, dir)
if ( ctrl_x_mode == CTRL_X_WHOLE_LINE if ( ctrl_x_mode == CTRL_X_WHOLE_LINE
|| (compl_cont_status & CONT_SOL)) || (compl_cont_status & CONT_SOL))
found_new_match = search_for_exact_line(ins_buf, pos, found_new_match = search_for_exact_line(ins_buf, pos,
dir, compl_pattern); compl_direction, compl_pattern);
else else
found_new_match = searchit(NULL, ins_buf, pos, dir, found_new_match = searchit(NULL, ins_buf, pos,
compl_direction,
compl_pattern, 1L, SEARCH_KEEP + SEARCH_NFMSG, compl_pattern, 1L, SEARCH_KEEP + SEARCH_NFMSG,
RE_LAST); RE_LAST);
if (!compl_started) if (!compl_started)
@@ -3335,7 +3430,7 @@ ins_compl_get_exp(ini, dir)
} }
if (ins_compl_add_infercase(ptr, len, if (ins_compl_add_infercase(ptr, len,
ins_buf == curbuf ? NULL : ins_buf->b_sfname, ins_buf == curbuf ? NULL : ins_buf->b_sfname,
dir, flags) != NOTDONE) 0, flags) != NOTDONE)
{ {
found_new_match = OK; found_new_match = OK;
break; break;
@@ -3388,7 +3483,7 @@ ins_compl_get_exp(ini, dir)
/* If several matches were added (FORWARD) or the search failed and has /* If several matches were added (FORWARD) or the search failed and has
* just been made cyclic then we have to move compl_curr_match to the next * just been made cyclic then we have to move compl_curr_match to the next
* or previous entry (if any) -- Acevedo */ * or previous entry (if any) -- Acevedo */
compl_curr_match = dir == FORWARD ? old_match->cp_next : old_match->cp_prev; compl_curr_match = compl_direction == FORWARD ? old_match->cp_next : old_match->cp_prev;
if (compl_curr_match == NULL) if (compl_curr_match == NULL)
compl_curr_match = old_match; compl_curr_match = old_match;
return i; return i;
@@ -3476,7 +3571,7 @@ ins_compl_next(allow_get_expansion, count)
if (!allow_get_expansion) if (!allow_get_expansion)
return -1; return -1;
num_matches = ins_compl_get_exp(&compl_startpos, compl_direction); num_matches = ins_compl_get_exp(&compl_startpos);
if (compl_pending && compl_direction == compl_shows_dir) if (compl_pending && compl_direction == compl_shows_dir)
compl_shown_match = compl_curr_match; compl_shown_match = compl_curr_match;
found_end = FALSE; found_end = FALSE;
@@ -3992,7 +4087,7 @@ ins_complete(c)
* when the list of matches is freed. */ * when the list of matches is freed. */
compl_orig_text = vim_strnsave(line + compl_col, compl_length); compl_orig_text = vim_strnsave(line + compl_col, compl_length);
if (compl_orig_text == NULL || ins_compl_add(compl_orig_text, if (compl_orig_text == NULL || ins_compl_add(compl_orig_text,
-1, NULL, 0, ORIGINAL_TEXT) != OK) -1, NULL, NULL, 0, ORIGINAL_TEXT) != OK)
{ {
vim_free(compl_pattern); vim_free(compl_pattern);
compl_pattern = NULL; compl_pattern = NULL;

View File

@@ -6342,20 +6342,26 @@ dict_find(d, key, len)
} }
/* /*
* Get a string item from a dictionary in allocated memory. * Get a string item from a dictionary.
* When "save" is TRUE allocate memory for it.
* Returns NULL if the entry doesn't exist or out of memory. * Returns NULL if the entry doesn't exist or out of memory.
*/ */
char_u * char_u *
get_dict_string(d, key) get_dict_string(d, key, save)
dict_T *d; dict_T *d;
char_u *key; char_u *key;
int save;
{ {
dictitem_T *di; dictitem_T *di;
char_u *s;
di = dict_find(d, key, -1); di = dict_find(d, key, -1);
if (di == NULL) if (di == NULL)
return NULL; return NULL;
return vim_strsave(get_tv_string(&di->di_tv)); s = get_tv_string(&di->di_tv);
if (save && s != NULL)
s = vim_strsave(s);
return s;
} }
/* /*
@@ -8014,11 +8020,20 @@ f_complete_add(argvars, rettv)
typval_T *argvars; typval_T *argvars;
typval_T *rettv; typval_T *rettv;
{ {
char_u *s; char_u *word;
char_u *extra = NULL;
s = get_tv_string_chk(&argvars[0]); if (argvars[0].v_type == VAR_DICT && argvars[0].vval.v_dict != NULL)
if (s != NULL) {
rettv->vval.v_number = ins_compl_add(s, -1, NULL, FORWARD, 0); word = get_dict_string(argvars[0].vval.v_dict,
(char_u *)"word", FALSE);
extra = get_dict_string(argvars[0].vval.v_dict,
(char_u *)"menu", FALSE);
}
else
word = get_tv_string_chk(&argvars[0]);
if (word != NULL)
rettv->vval.v_number = ins_compl_add(word, -1, NULL, extra, 0, 0);
} }
/* /*

View File

@@ -515,6 +515,8 @@ EX(CMD_lgrep, "lgrep", ex_make,
BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE),
EX(CMD_lgrepadd, "lgrepadd", ex_make, EX(CMD_lgrepadd, "lgrepadd", ex_make,
BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE),
EX(CMD_lhelpgrep, "lhelpgrep", ex_helpgrep,
EXTRA|NOTRLCOM|NEEDARG),
EX(CMD_ll, "ll", ex_cc, EX(CMD_ll, "ll", ex_cc,
RANGE|NOTADR|COUNT|TRLBAR|BANG), RANGE|NOTADR|COUNT|TRLBAR|BANG),
EX(CMD_llast, "llast", ex_cc, EX(CMD_llast, "llast", ex_cc,

View File

@@ -75,6 +75,7 @@ static int getConnInfo __ARGS((char *file, char **host, char **port, char **pass
static void nb_init_graphics __ARGS((void)); static void nb_init_graphics __ARGS((void));
static void coloncmd __ARGS((char *cmd, ...)); static void coloncmd __ARGS((char *cmd, ...));
static void nb_set_curbuf __ARGS((buf_T *buf));
#ifdef FEAT_GUI_MOTIF #ifdef FEAT_GUI_MOTIF
static void messageFromNetbeans __ARGS((XtPointer, int *, XtInputId *)); static void messageFromNetbeans __ARGS((XtPointer, int *, XtInputId *));
#endif #endif
@@ -1365,8 +1366,7 @@ nb_do_cmd(
netbeansFireChanges = FALSE; netbeansFireChanges = FALSE;
netbeansSuppressNoLines = TRUE; netbeansSuppressNoLines = TRUE;
if (curbuf != buf->bufp) nb_set_curbuf(buf->bufp);
set_curbuf(buf->bufp, DOBUF_GOTO);
wasChanged = buf->bufp->b_changed; wasChanged = buf->bufp->b_changed;
cp = (char *)args; cp = (char *)args;
off = strtol(cp, &cp, 10); off = strtol(cp, &cp, 10);
@@ -1488,8 +1488,7 @@ nb_do_cmd(
netbeansFireChanges = 0; netbeansFireChanges = 0;
lbuf[0] = '\0'; lbuf[0] = '\0';
if (curbuf != buf->bufp) nb_set_curbuf(buf->bufp);
set_curbuf(buf->bufp, DOBUF_GOTO);
old_b_changed = buf->bufp->b_changed; old_b_changed = buf->bufp->b_changed;
pos = off2pos(buf->bufp, off); pos = off2pos(buf->bufp, off);
@@ -1694,8 +1693,7 @@ nb_do_cmd(
} }
doupdate = 1; doupdate = 1;
buf->initDone = TRUE; buf->initDone = TRUE;
if (curbuf != buf->bufp) nb_set_curbuf(buf->bufp);
set_curbuf(buf->bufp, DOBUF_GOTO);
#if defined(FEAT_AUTOCMD) #if defined(FEAT_AUTOCMD)
apply_autocmds(EVENT_BUFREADPOST, 0, 0, FALSE, buf->bufp); apply_autocmds(EVENT_BUFREADPOST, 0, 0, FALSE, buf->bufp);
#endif #endif
@@ -1891,8 +1889,8 @@ nb_do_cmd(
return FAIL; return FAIL;
} }
if (curbuf != buf->bufp) nb_set_curbuf(buf->bufp);
set_curbuf(buf->bufp, DOBUF_GOTO);
#ifdef FEAT_VISUAL #ifdef FEAT_VISUAL
/* Don't want Visual mode now. */ /* Don't want Visual mode now. */
if (VIsual_active) if (VIsual_active)
@@ -2140,8 +2138,7 @@ nb_do_cmd(
nbdebug((" null bufp in %s command", cmd)); nbdebug((" null bufp in %s command", cmd));
return FAIL; return FAIL;
} }
if (curbuf != buf->bufp) nb_set_curbuf(buf->bufp);
set_curbuf(buf->bufp, DOBUF_GOTO);
cp = (char *)args; cp = (char *)args;
off = strtol(cp, &cp, 10); off = strtol(cp, &cp, 10);
len = strtol(cp, NULL, 10); len = strtol(cp, NULL, 10);
@@ -2314,6 +2311,19 @@ nb_do_cmd(
} }
/*
* If "buf" is not the current buffer try changing to a window that edits this
* buffer. If there is no such window then close the current buffer and set
* the current buffer as "buf".
*/
static void
nb_set_curbuf(buf)
buf_T *buf;
{
if (curbuf != buf && buf_jump_open_win(buf) == NULL)
set_curbuf(buf, DOBUF_GOTO);
}
/* /*
* Process a vim colon command. * Process a vim colon command.
*/ */

View File

@@ -14,13 +14,14 @@
#if defined(FEAT_INS_EXPAND) || defined(PROTO) #if defined(FEAT_INS_EXPAND) || defined(PROTO)
static char_u **pum_array = NULL; /* items of displayed pum */ static pumitem_T *pum_array = NULL; /* items of displayed pum */
static int pum_size; /* nr of items in "pum_array" */ static int pum_size; /* nr of items in "pum_array" */
static int pum_selected; /* index of selected item or -1 */ static int pum_selected; /* index of selected item or -1 */
static int pum_first = 0; /* index of top item */ static int pum_first = 0; /* index of top item */
static int pum_height; /* nr of displayed pum items */ static int pum_height; /* nr of displayed pum items */
static int pum_width; /* width of displayed pum items */ static int pum_width; /* width of displayed pum items */
static int pum_base_width; /* width of pum items base */
static int pum_scrollbar; /* TRUE when scrollbar present */ static int pum_scrollbar; /* TRUE when scrollbar present */
static int pum_row; /* top row of pum */ static int pum_row; /* top row of pum */
@@ -37,7 +38,7 @@ static int pum_col; /* left column of pum */
*/ */
void void
pum_display(array, size, selected, row, height, col) pum_display(array, size, selected, row, height, col)
char_u **array; pumitem_T *array;
int size; int size;
int selected; /* index of initially selected item */ int selected; /* index of initially selected item */
int row; int row;
@@ -47,6 +48,7 @@ pum_display(array, size, selected, row, height, col)
int w; int w;
int def_width = PUM_DEF_WIDTH; int def_width = PUM_DEF_WIDTH;
int max_width = 0; int max_width = 0;
int extra_width = 0;
int i; int i;
/* /*
@@ -87,13 +89,20 @@ pum_display(array, size, selected, row, height, col)
if (pum_height < 1 || (pum_height == 1 && size > 1)) if (pum_height < 1 || (pum_height == 1 && size > 1))
return; return;
/* Compute the width of the widest match. */ /* Compute the width of the widest match and the widest extra. */
for (i = 0; i < size; ++i) for (i = 0; i < size; ++i)
{ {
w = vim_strsize(array[i]); w = vim_strsize(array[i].pum_text);
if (max_width < w) if (max_width < w)
max_width = w; max_width = w;
if (array[i].pum_extra != NULL)
{
w = vim_strsize(array[i].pum_extra);
if (extra_width < w)
extra_width = w;
}
} }
pum_base_width = max_width;
/* if there are more items than room we need a scrollbar */ /* if there are more items than room we need a scrollbar */
if (pum_height < size) if (pum_height < size)
@@ -112,8 +121,13 @@ pum_display(array, size, selected, row, height, col)
/* align pum column with "col" */ /* align pum column with "col" */
pum_col = col; pum_col = col;
pum_width = Columns - pum_col - pum_scrollbar; pum_width = Columns - pum_col - pum_scrollbar;
if (pum_width > def_width) if (pum_width > max_width + extra_width + 1
pum_width = def_width; && pum_width > PUM_DEF_WIDTH)
{
pum_width = max_width + extra_width + 1;
if (pum_width < PUM_DEF_WIDTH)
pum_width = PUM_DEF_WIDTH;
}
} }
else if (Columns < def_width) else if (Columns < def_width)
{ {
@@ -153,9 +167,10 @@ pum_redraw()
int idx; int idx;
char_u *s; char_u *s;
char_u *p; char_u *p;
int width, w; int totwidth, width, w;
int thumb_pos = 0; int thumb_pos = 0;
int thumb_heigth = 1; int thumb_heigth = 1;
int round;
if (pum_scrollbar) if (pum_scrollbar)
{ {
@@ -176,32 +191,46 @@ pum_redraw()
if (pum_col > 0) if (pum_col > 0)
screen_putchar(' ', row, pum_col - 1, attr); screen_putchar(' ', row, pum_col - 1, attr);
/* Display each entry, use two spaces for a Tab. */ /* Display each entry, use two spaces for a Tab.
* Do this twice: For the main text and for the extra info */
col = pum_col; col = pum_col;
width = 0; totwidth = 0;
s = NULL; for (round = 1; round <= 2; ++round)
for (p = pum_array[idx]; ; mb_ptr_adv(p))
{ {
if (s == NULL) width = 0;
s = p; s = NULL;
w = ptr2cells(p); for (p = round == 1 ? pum_array[idx].pum_text
if (*p == NUL || *p == TAB || width + w > pum_width) : pum_array[idx].pum_extra; ; mb_ptr_adv(p))
{ {
/* Display the text that fits or comes before a Tab. */ if (s == NULL)
screen_puts_len(s, p - s, row, col, attr); s = p;
col += width; w = ptr2cells(p);
if (*p == NUL || *p == TAB || totwidth + w > pum_width)
{
/* Display the text that fits or comes before a Tab. */
screen_puts_len(s, p - s, row, col, attr);
col += width;
if (*p != TAB) if (*p != TAB)
break; break;
/* Display two spaces for a Tab. */ /* Display two spaces for a Tab. */
screen_puts_len((char_u *)" ", 2, row, col, attr); screen_puts_len((char_u *)" ", 2, row, col, attr);
col += 2; col += 2;
s = NULL; totwidth += 2;
width = 0; s = NULL; /* start text at next char */
width = 0;
}
else
width += w;
} }
else if (round == 2 || pum_array[idx].pum_extra == NULL
width += w; || pum_base_width + 1 >= pum_width)
break;
screen_fill(row, row + 1, col, pum_col + pum_base_width + 1,
' ', ' ', attr);
col = pum_col + pum_base_width + 1;
totwidth = pum_base_width + 1;
} }
screen_fill(row, row + 1, col, pum_col + pum_width, ' ', ' ', attr); screen_fill(row, row + 1, col, pum_col + pum_width, ' ', ' ', attr);

View File

@@ -8,7 +8,7 @@ void truncate_spaces __ARGS((char_u *line));
void backspace_until_column __ARGS((int col)); void backspace_until_column __ARGS((int col));
int vim_is_ctrl_x_key __ARGS((int c)); int vim_is_ctrl_x_key __ARGS((int c));
int ins_compl_add_infercase __ARGS((char_u *str, int len, char_u *fname, int dir, int flags)); int ins_compl_add_infercase __ARGS((char_u *str, int len, char_u *fname, int dir, int flags));
int ins_compl_add __ARGS((char_u *str, int len, char_u *fname, int dir, int flags)); int ins_compl_add __ARGS((char_u *str, int len, char_u *fname, char_u *extra, int cdir, int flags));
void ins_compl_show_pum __ARGS((void)); void ins_compl_show_pum __ARGS((void));
char_u *find_word_start __ARGS((char_u *ptr)); char_u *find_word_start __ARGS((char_u *ptr));
char_u *find_word_end __ARGS((char_u *ptr)); char_u *find_word_end __ARGS((char_u *ptr));

View File

@@ -42,15 +42,15 @@ void ex_lockvar __ARGS((exarg_T *eap));
int do_unlet __ARGS((char_u *name, int forceit)); int do_unlet __ARGS((char_u *name, int forceit));
void del_menutrans_vars __ARGS((void)); void del_menutrans_vars __ARGS((void));
char_u *get_user_var_name __ARGS((expand_T *xp, int idx)); char_u *get_user_var_name __ARGS((expand_T *xp, int idx));
list_T *list_alloc __ARGS((void));
void list_unref __ARGS((list_T *l)); void list_unref __ARGS((list_T *l));
void list_free __ARGS((list_T *l));
dictitem_T *dict_lookup __ARGS((hashitem_T *hi)); dictitem_T *dict_lookup __ARGS((hashitem_T *hi));
int list_append_dict __ARGS((list_T *list, dict_T *dict)); int list_append_dict __ARGS((list_T *list, dict_T *dict));
int garbage_collect __ARGS((void)); int garbage_collect __ARGS((void));
list_T *list_alloc __ARGS((void));
void list_free __ARGS((list_T *l));
dict_T *dict_alloc __ARGS((void)); dict_T *dict_alloc __ARGS((void));
int dict_add_nr_str __ARGS((dict_T *d, char *key, long nr, char_u *str)); int dict_add_nr_str __ARGS((dict_T *d, char *key, long nr, char_u *str));
char_u *get_dict_string __ARGS((dict_T *d, char_u *key)); char_u *get_dict_string __ARGS((dict_T *d, char_u *key, int save));
long get_dict_number __ARGS((dict_T *d, char_u *key)); long get_dict_number __ARGS((dict_T *d, char_u *key));
char_u *get_function_name __ARGS((expand_T *xp, int idx)); char_u *get_function_name __ARGS((expand_T *xp, int idx));
char_u *get_expr_name __ARGS((expand_T *xp, int idx)); char_u *get_expr_name __ARGS((expand_T *xp, int idx));

View File

@@ -1,5 +1,5 @@
/* popupmenu.c */ /* popupmenu.c */
void pum_display __ARGS((char_u **array, int size, int selected, int row, int height, int col)); void pum_display __ARGS((pumitem_T *array, int size, int selected, int row, int height, int col));
void pum_redraw __ARGS((void)); void pum_redraw __ARGS((void));
void pum_set_selected __ARGS((int n)); void pum_set_selected __ARGS((int n));
void pum_undisplay __ARGS((void)); void pum_undisplay __ARGS((void));

View File

@@ -1,7 +1,8 @@
/* quickfix.c */ /* quickfix.c */
int qf_init __ARGS((win_T *wp, char_u *efile, char_u *errorformat, int newlist)); int qf_init __ARGS((win_T *wp, char_u *efile, char_u *errorformat, int newlist));
void qf_free_all __ARGS((win_T *wp)); void qf_free_all __ARGS((win_T *wp));
void qf_jump __ARGS((win_T *wp, int dir, int errornr, int forceit)); void copy_loclist __ARGS((win_T *from, win_T *to));
void qf_jump __ARGS((qf_info_T *qi, int dir, int errornr, int forceit));
void qf_list __ARGS((exarg_T *eap)); void qf_list __ARGS((exarg_T *eap));
void qf_age __ARGS((exarg_T *eap)); void qf_age __ARGS((exarg_T *eap));
void qf_mark_adjust __ARGS((win_T *wp, linenr_T line1, linenr_T line2, long amount, long amount_after)); void qf_mark_adjust __ARGS((win_T *wp, linenr_T line1, linenr_T line2, long amount, long amount_after));
@@ -26,5 +27,4 @@ int set_errorlist __ARGS((win_T *wp, list_T *list, int action));
void ex_cbuffer __ARGS((exarg_T *eap)); void ex_cbuffer __ARGS((exarg_T *eap));
void ex_cexpr __ARGS((exarg_T *eap)); void ex_cexpr __ARGS((exarg_T *eap));
void ex_helpgrep __ARGS((exarg_T *eap)); void ex_helpgrep __ARGS((exarg_T *eap));
void copy_loclist __ARGS((win_T *from, win_T *to));
/* vim: set ft=c : */ /* vim: set ft=c : */

View File

@@ -954,19 +954,21 @@ qf_add_entry(qi, prevp, dir, fname, mesg, lnum, col, vis_col, pattern, nr, type,
} }
/* /*
* Allocate a new location list for window 'wp' * Allocate a new location list
*/ */
static int static qf_info_T *
ll_new_list(wp) ll_new_list()
win_T *wp;
{ {
if ((wp->w_llist = (qf_info_T *)alloc((unsigned)sizeof(qf_info_T))) == NULL) qf_info_T *qi;
return FAIL;
vim_memset(wp->w_llist, 0, (size_t)(sizeof(qf_info_T))); qi = (qf_info_T *)alloc((unsigned)sizeof(qf_info_T));
wp->w_llist->qf_refcount++; if (qi != NULL)
{
vim_memset(qi, 0, (size_t)(sizeof(qf_info_T)));
qi->qf_refcount++;
}
return OK; return qi;
} }
/* /*
@@ -988,8 +990,7 @@ ll_get_or_alloc_list(wp)
ll_free_all(&wp->w_llist_ref); ll_free_all(&wp->w_llist_ref);
if (wp->w_llist == NULL) if (wp->w_llist == NULL)
if (ll_new_list(wp) == FAIL) /* new location list */ wp->w_llist = ll_new_list(); /* new location list */
return NULL;
return wp->w_llist; return wp->w_llist;
} }
@@ -1018,7 +1019,8 @@ copy_loclist(from, to)
if (qi == NULL) /* no location list to copy */ if (qi == NULL) /* no location list to copy */
return; return;
if (ll_new_list(to) == FAIL) /* allocate a new location list */ /* allocate a new location list */
if ((to->w_llist = ll_new_list()) == NULL)
return; return;
to->w_llist->qf_listcount = qi->qf_listcount; to->w_llist->qf_listcount = qi->qf_listcount;
@@ -1331,13 +1333,12 @@ qf_guess_filepath(filename)
* else go to entry "errornr" * else go to entry "errornr"
*/ */
void void
qf_jump(winptr, dir, errornr, forceit) qf_jump(qi, dir, errornr, forceit)
win_T *winptr; qf_info_T *qi;
int dir; int dir;
int errornr; int errornr;
int forceit; int forceit;
{ {
qf_info_T *qi = &ql_info;
qf_info_T *ll_ref; qf_info_T *ll_ref;
qfline_T *qf_ptr; qfline_T *qf_ptr;
qfline_T *old_qf_ptr; qfline_T *old_qf_ptr;
@@ -1367,8 +1368,8 @@ qf_jump(winptr, dir, errornr, forceit)
int ok = OK; int ok = OK;
int usable_win; int usable_win;
if (winptr != NULL) if (qi == NULL)
qi = GET_LOC_LIST(winptr); qi = &ql_info;
if (qi->qf_curlist >= qi->qf_listcount if (qi->qf_curlist >= qi->qf_listcount
|| qi->qf_lists[qi->qf_curlist].qf_count == 0) || qi->qf_lists[qi->qf_curlist].qf_count == 0)
@@ -1494,6 +1495,14 @@ qf_jump(winptr, dir, errornr, forceit)
if (curwin->w_height < p_hh) if (curwin->w_height < p_hh)
win_setheight((int)p_hh); win_setheight((int)p_hh);
if (qi != &ql_info) /* not a quickfix list */
{
/* The new window should use the supplied location list */
qf_free_all(curwin);
curwin->w_llist = qi;
qi->qf_refcount++;
}
} }
if (!p_im) if (!p_im)
@@ -2583,7 +2592,7 @@ ex_make(eap)
char_u *cmd; char_u *cmd;
unsigned len; unsigned len;
win_T *wp = NULL; win_T *wp = NULL;
qf_info_T *qi; qf_info_T *qi = &ql_info;
#ifdef FEAT_AUTOCMD #ifdef FEAT_AUTOCMD
char_u *au_name = NULL; char_u *au_name = NULL;
@@ -2667,7 +2676,7 @@ ex_make(eap)
(eap->cmdidx != CMD_grepadd (eap->cmdidx != CMD_grepadd
&& eap->cmdidx != CMD_lgrepadd)) > 0 && eap->cmdidx != CMD_lgrepadd)) > 0
&& !eap->forceit) && !eap->forceit)
qf_jump(wp, 0, 0, FALSE); /* display first error */ qf_jump(qi, 0, 0, FALSE); /* display first error */
mch_remove(fname); mch_remove(fname);
vim_free(fname); vim_free(fname);
@@ -2745,11 +2754,12 @@ get_mef_name()
ex_cc(eap) ex_cc(eap)
exarg_T *eap; exarg_T *eap;
{ {
win_T *wp = NULL; qf_info_T *qi = &ql_info;
qf_info_T *qi;
if (eap->cmdidx == CMD_ll || eap->cmdidx == CMD_lrewind if (eap->cmdidx == CMD_ll
|| eap->cmdidx == CMD_lfirst || eap->cmdidx == CMD_llast) || eap->cmdidx == CMD_lrewind
|| eap->cmdidx == CMD_lfirst
|| eap->cmdidx == CMD_llast)
{ {
qi = GET_LOC_LIST(curwin); qi = GET_LOC_LIST(curwin);
if (qi == NULL) if (qi == NULL)
@@ -2757,10 +2767,9 @@ ex_cc(eap)
EMSG(_(e_loclist)); EMSG(_(e_loclist));
return; return;
} }
wp = curwin;
} }
qf_jump(wp, 0, qf_jump(qi, 0,
eap->addr_count > 0 eap->addr_count > 0
? (int)eap->line2 ? (int)eap->line2
: (eap->cmdidx == CMD_cc || eap->cmdidx == CMD_ll) : (eap->cmdidx == CMD_cc || eap->cmdidx == CMD_ll)
@@ -2780,12 +2789,14 @@ ex_cc(eap)
ex_cnext(eap) ex_cnext(eap)
exarg_T *eap; exarg_T *eap;
{ {
win_T *wp = NULL; qf_info_T *qi = &ql_info;
qf_info_T *qi;
if (eap->cmdidx == CMD_lnext || eap->cmdidx == CMD_lNext if (eap->cmdidx == CMD_lnext
|| eap->cmdidx == CMD_lprevious || eap->cmdidx == CMD_lnfile || eap->cmdidx == CMD_lNext
|| eap->cmdidx == CMD_lNfile || eap->cmdidx == CMD_lpfile) || eap->cmdidx == CMD_lprevious
|| eap->cmdidx == CMD_lnfile
|| eap->cmdidx == CMD_lNfile
|| eap->cmdidx == CMD_lpfile)
{ {
qi = GET_LOC_LIST(curwin); qi = GET_LOC_LIST(curwin);
if (qi == NULL) if (qi == NULL)
@@ -2793,10 +2804,9 @@ ex_cnext(eap)
EMSG(_(e_loclist)); EMSG(_(e_loclist));
return; return;
} }
wp = curwin;
} }
qf_jump(wp, (eap->cmdidx == CMD_cnext || eap->cmdidx == CMD_lnext) qf_jump(qi, (eap->cmdidx == CMD_cnext || eap->cmdidx == CMD_lnext)
? FORWARD ? FORWARD
: (eap->cmdidx == CMD_cnfile || eap->cmdidx == CMD_lnfile) : (eap->cmdidx == CMD_cnfile || eap->cmdidx == CMD_lnfile)
? FORWARD_FILE ? FORWARD_FILE
@@ -2816,7 +2826,7 @@ ex_cfile(eap)
exarg_T *eap; exarg_T *eap;
{ {
win_T *wp = NULL; win_T *wp = NULL;
qf_info_T *qi; qf_info_T *qi = &ql_info;
if (eap->cmdidx == CMD_lfile || eap->cmdidx == CMD_lgetfile if (eap->cmdidx == CMD_lfile || eap->cmdidx == CMD_lgetfile
|| eap->cmdidx == CMD_laddfile) || eap->cmdidx == CMD_laddfile)
@@ -2844,7 +2854,7 @@ ex_cfile(eap)
&& eap->cmdidx != CMD_laddfile)) > 0 && eap->cmdidx != CMD_laddfile)) > 0
&& (eap->cmdidx == CMD_cfile && (eap->cmdidx == CMD_cfile
|| eap->cmdidx == CMD_lfile)) || eap->cmdidx == CMD_lfile))
qf_jump(wp, 0, 0, eap->forceit); /* display first error */ qf_jump(qi, 0, 0, eap->forceit); /* display first error */
} }
/* /*
@@ -2865,7 +2875,6 @@ ex_vimgrep(eap)
int fi; int fi;
qf_info_T *qi = &ql_info; qf_info_T *qi = &ql_info;
qfline_T *prevp = NULL; qfline_T *prevp = NULL;
win_T *wp = NULL;
long lnum; long lnum;
buf_T *buf; buf_T *buf;
int duplicate_name = FALSE; int duplicate_name = FALSE;
@@ -2899,13 +2908,14 @@ ex_vimgrep(eap)
} }
#endif #endif
if (eap->cmdidx == CMD_grep || eap->cmdidx == CMD_lvimgrep if (eap->cmdidx == CMD_grep
|| eap->cmdidx == CMD_lgrepadd || eap->cmdidx == CMD_lvimgrepadd) || eap->cmdidx == CMD_lvimgrep
|| eap->cmdidx == CMD_lgrepadd
|| eap->cmdidx == CMD_lvimgrepadd)
{ {
qi = ll_get_or_alloc_list(curwin); qi = ll_get_or_alloc_list(curwin);
if (qi == NULL) if (qi == NULL)
return; return;
wp = curwin;
} }
/* Get the search pattern: either white-separated or enclosed in // */ /* Get the search pattern: either white-separated or enclosed in // */
@@ -3105,7 +3115,7 @@ ex_vimgrep(eap)
if (qi->qf_lists[qi->qf_curlist].qf_count > 0) if (qi->qf_lists[qi->qf_curlist].qf_count > 0)
{ {
if ((flags & VGR_NOJUMP) == 0) if ((flags & VGR_NOJUMP) == 0)
qf_jump(wp, 0, 0, eap->forceit); qf_jump(qi, 0, 0, eap->forceit);
} }
else else
EMSG2(_(e_nomatch2), s); EMSG2(_(e_nomatch2), s);
@@ -3376,14 +3386,14 @@ set_errorlist(wp, list, action)
if (d == NULL) if (d == NULL)
continue; continue;
filename = get_dict_string(d, (char_u *)"filename"); filename = get_dict_string(d, (char_u *)"filename", TRUE);
lnum = get_dict_number(d, (char_u *)"lnum"); lnum = get_dict_number(d, (char_u *)"lnum");
col = get_dict_number(d, (char_u *)"col"); col = get_dict_number(d, (char_u *)"col");
vcol = get_dict_number(d, (char_u *)"vcol"); vcol = get_dict_number(d, (char_u *)"vcol");
nr = get_dict_number(d, (char_u *)"nr"); nr = get_dict_number(d, (char_u *)"nr");
type = get_dict_string(d, (char_u *)"type"); type = get_dict_string(d, (char_u *)"type", TRUE);
pattern = get_dict_string(d, (char_u *)"pattern"); pattern = get_dict_string(d, (char_u *)"pattern", TRUE);
text = get_dict_string(d, (char_u *)"text"); text = get_dict_string(d, (char_u *)"text", TRUE);
if (text == NULL) if (text == NULL)
text = vim_strsave((char_u *)""); text = vim_strsave((char_u *)"");
@@ -3484,14 +3494,12 @@ ex_cexpr(eap)
{ {
typval_T *tv; typval_T *tv;
qf_info_T *qi = &ql_info; qf_info_T *qi = &ql_info;
win_T *wp = NULL;
if (eap->cmdidx == CMD_lexpr || eap->cmdidx == CMD_laddexpr) if (eap->cmdidx == CMD_lexpr || eap->cmdidx == CMD_laddexpr)
{ {
qi = ll_get_or_alloc_list(curwin); qi = ll_get_or_alloc_list(curwin);
if (qi == NULL) if (qi == NULL)
return; return;
wp = curwin;
} }
/* Evaluate the expression. When the result is a string or a list we can /* Evaluate the expression. When the result is a string or a list we can
@@ -3507,7 +3515,7 @@ ex_cexpr(eap)
|| eap->cmdidx == CMD_lexpr), || eap->cmdidx == CMD_lexpr),
(linenr_T)0, (linenr_T)0) > 0 (linenr_T)0, (linenr_T)0) > 0
&& (eap->cmdidx == CMD_cexpr || eap->cmdidx == CMD_lexpr)) && (eap->cmdidx == CMD_cexpr || eap->cmdidx == CMD_lexpr))
qf_jump(wp, 0, 0, eap->forceit); /* display first error */ qf_jump(qi, 0, 0, eap->forceit); /* display first error */
} }
else else
EMSG(_("E777: String or List expected")); EMSG(_("E777: String or List expected"));
@@ -3536,6 +3544,8 @@ ex_helpgrep(eap)
char_u *lang; char_u *lang;
#endif #endif
qf_info_T *qi = &ql_info; qf_info_T *qi = &ql_info;
int new_qi = FALSE;
win_T *wp;
/* Make 'cpoptions' empty, the 'l' flag should not be used here. */ /* Make 'cpoptions' empty, the 'l' flag should not be used here. */
save_cpo = p_cpo; save_cpo = p_cpo;
@@ -3546,6 +3556,27 @@ ex_helpgrep(eap)
lang = check_help_lang(eap->arg); lang = check_help_lang(eap->arg);
#endif #endif
if (eap->cmdidx == CMD_lhelpgrep)
{
/* Find an existing help window */
FOR_ALL_WINDOWS(wp)
if (wp->w_buffer != NULL && wp->w_buffer->b_help)
break;
if (wp == NULL) /* Help window not found */
qi = NULL;
else
qi = wp->w_llist;
if (qi == NULL)
{
/* Allocate a new location list for help text matches */
if ((qi = ll_new_list()) == NULL)
return;
new_qi = TRUE;
}
}
regmatch.regprog = vim_regcomp(eap->arg, RE_MAGIC + RE_STRING); regmatch.regprog = vim_regcomp(eap->arg, RE_MAGIC + RE_STRING);
regmatch.rm_ic = FALSE; regmatch.rm_ic = FALSE;
if (regmatch.regprog != NULL) if (regmatch.regprog != NULL)
@@ -3635,9 +3666,23 @@ ex_helpgrep(eap)
/* Jump to first match. */ /* Jump to first match. */
if (qi->qf_lists[qi->qf_curlist].qf_count > 0) if (qi->qf_lists[qi->qf_curlist].qf_count > 0)
qf_jump(NULL, 0, 0, FALSE); qf_jump(qi, 0, 0, FALSE);
else else
EMSG2(_(e_nomatch2), eap->arg); EMSG2(_(e_nomatch2), eap->arg);
if (eap->cmdidx == CMD_lhelpgrep)
{
/* If the help window is not opened or if it already points to the
* correct location list, then free the new location list
*/
if (!curwin->w_buffer->b_help || curwin->w_llist == qi)
{
if (new_qi)
ll_free_all(&qi);
}
else if (curwin->w_llist == NULL)
curwin->w_llist = qi;
}
} }
#endif /* FEAT_QUICKFIX */ #endif /* FEAT_QUICKFIX */

View File

@@ -1085,9 +1085,7 @@ struct dictvar_S
# define B_SPELL(buf) (0) # define B_SPELL(buf) (0)
#endif #endif
#ifdef FEAT_QUICKFIX
typedef struct qf_info_S qf_info_T; typedef struct qf_info_S qf_info_T;
#endif
/* /*
* buffer: structure that holds information about one file * buffer: structure that holds information about one file
@@ -2148,3 +2146,13 @@ typedef struct
} prt_settings_T; } prt_settings_T;
#define PRINT_NUMBER_WIDTH 8 #define PRINT_NUMBER_WIDTH 8
/*
* Used for popup menu items.
*/
typedef struct
{
char_u *pum_text; /* main menu text */
char_u *pum_extra; /* extra menu text (may be truncated) */
char_u *pum_info; /* extra info */
} pumitem_T;

View File

@@ -36,5 +36,5 @@
#define VIM_VERSION_NODOT "vim70aa" #define VIM_VERSION_NODOT "vim70aa"
#define VIM_VERSION_SHORT "7.0aa" #define VIM_VERSION_SHORT "7.0aa"
#define VIM_VERSION_MEDIUM "7.0aa ALPHA" #define VIM_VERSION_MEDIUM "7.0aa ALPHA"
#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2006 Feb 4)" #define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2006 Feb 7)"
#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2006 Feb 4, compiled " #define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2006 Feb 7, compiled "