updated for version 7.0g
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
" Vim completion script
|
||||
" Language: CSS 2.1
|
||||
" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
|
||||
" Last Change: 2005 Oct 12
|
||||
" Last Change: 2006 Apr 30
|
||||
|
||||
function! csscomplete#CompleteCSS(findstart, base)
|
||||
if a:findstart
|
||||
@ -19,12 +19,12 @@ else
|
||||
" ^ ; : { } /* */
|
||||
" Where ^ is start of line and /* */ are comment borders
|
||||
" Depending on their relative position to cursor we will now what should
|
||||
" be completed.
|
||||
" be completed.
|
||||
" 1. if nearest are ^ or { or ; current word is property
|
||||
" 2. if : it is value (with exception of pseudo things)
|
||||
" 3. if } we are outside of css definitions
|
||||
" 4. for comments ignoring is be the easiest but assume they are the same
|
||||
" as 1.
|
||||
" as 1.
|
||||
" 5. if @ complete at-rule
|
||||
" 6. if ! complete important
|
||||
if exists("b:compl_context")
|
||||
@ -385,7 +385,7 @@ else
|
||||
let filestart = matchstr(entered_atruleafter, "^url([\"']\\?\\zs.*")
|
||||
let files = split(glob(filestart.'*'), '\n')
|
||||
let values = map(copy(files), '"url(".v:val')
|
||||
|
||||
|
||||
else
|
||||
let values = ['"', 'url(']
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
" Vim completion script
|
||||
" Language: HTML and XHTML
|
||||
" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
|
||||
" Last Change: 2006 Apr 24
|
||||
" Last Change: 2006 Apr 30
|
||||
|
||||
function! htmlcomplete#CompleteTags(findstart, base)
|
||||
if a:findstart
|
||||
@ -23,7 +23,7 @@ function! htmlcomplete#CompleteTags(findstart, base)
|
||||
" Handling of <style> tag {{{
|
||||
let stylestart = searchpair('<style\>', '', '<\/style\>', "bnW")
|
||||
let styleend = searchpair('<style\>', '', '<\/style\>', "nW")
|
||||
if stylestart != 0 && styleend != 0
|
||||
if stylestart != 0 && styleend != 0
|
||||
if stylestart <= curline && styleend >= curline
|
||||
let start = col('.') - 1
|
||||
let b:csscompl = 1
|
||||
@ -36,7 +36,7 @@ function! htmlcomplete#CompleteTags(findstart, base)
|
||||
" Handling of <script> tag {{{
|
||||
let scriptstart = searchpair('<script\>', '', '<\/script\>', "bnW")
|
||||
let scriptend = searchpair('<script\>', '', '<\/script\>', "nW")
|
||||
if scriptstart != 0 && scriptend != 0
|
||||
if scriptstart != 0 && scriptend != 0
|
||||
if scriptstart <= curline && scriptend >= curline
|
||||
let start = col('.') - 1
|
||||
let b:jscompl = 1
|
||||
@ -109,7 +109,7 @@ function! htmlcomplete#CompleteTags(findstart, base)
|
||||
endwhile
|
||||
endif
|
||||
" If b:compl_context begins with <? we are inside of PHP code. It
|
||||
" wasn't closed so PHP completion passed it to HTML
|
||||
" wasn't closed so PHP completion passed it to HTML
|
||||
if &filetype =~? 'php' && b:compl_context =~ '^<?'
|
||||
let b:phpcompl = 1
|
||||
let start = col('.') - 1
|
||||
@ -200,7 +200,7 @@ function! htmlcomplete#CompleteTags(findstart, base)
|
||||
|
||||
" If context contains > it means we are already outside of tag and we
|
||||
" should abandon action
|
||||
" If context contains white space it is attribute.
|
||||
" If context contains white space it is attribute.
|
||||
" It can be also value of attribute.
|
||||
" We have to get first word to offer proper completions
|
||||
if context == ''
|
||||
@ -353,7 +353,7 @@ function! htmlcomplete#CompleteTags(findstart, base)
|
||||
let filelines = getline(1, line('$'))
|
||||
" 2. Find lines with possible id
|
||||
let used_id_lines = filter(filelines, 'v:val =~ "id\\s*=\\s*[\"''][a-zA-Z0-9_-]\\+"')
|
||||
" 3a. Join all filtered lines
|
||||
" 3a. Join all filtered lines
|
||||
let id_string = join(used_id_lines, ' ')
|
||||
" 3b. And split them to be sure each id is in separate item
|
||||
let id_list = split(id_string, 'id\s*=\s*')
|
||||
@ -432,7 +432,7 @@ function! htmlcomplete#CompleteTags(findstart, base)
|
||||
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.
|
||||
@ -508,7 +508,7 @@ function! htmlcomplete#CompleteTags(findstart, base)
|
||||
call htmlcomplete#LoadData()
|
||||
endif
|
||||
" }}}
|
||||
|
||||
|
||||
if has_key(b:html_omni, tag)
|
||||
let attrs = keys(b:html_omni[tag][1])
|
||||
else
|
||||
@ -600,7 +600,7 @@ function! htmlcomplete#CompleteTags(findstart, base)
|
||||
endif
|
||||
endif
|
||||
" }}}
|
||||
|
||||
|
||||
if exists("uppercase_tag") && uppercase_tag == 1
|
||||
let context = tolower(context)
|
||||
endif
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
" Vim completion script
|
||||
" Language: Java Script
|
||||
" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
|
||||
" Last Change: 2006 Feb 6
|
||||
" Last Change: 2006 Apr 30
|
||||
|
||||
function! javascriptcomplete#CompleteJS(findstart, base)
|
||||
if a:findstart
|
||||
@ -48,7 +48,7 @@ function! javascriptcomplete#CompleteJS(findstart, base)
|
||||
let doms = ['style.']
|
||||
" Arrays
|
||||
let arrayprop = ['constructor', 'index', 'input', 'length', 'prototype']
|
||||
let arraymeth = ['concat', 'join', 'pop', 'push', 'reverse', 'shift',
|
||||
let arraymeth = ['concat', 'join', 'pop', 'push', 'reverse', 'shift',
|
||||
\ 'splice', 'sort', 'toSource', 'toString', 'unshift', 'valueOf',
|
||||
\ 'watch', 'unwatch']
|
||||
call map(arraymeth, 'v:val."("')
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
" Vim completion script
|
||||
" Language: PHP
|
||||
" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
|
||||
" Last Change: 2006 Apr 15
|
||||
" Last Change: 2006 Apr 30
|
||||
"
|
||||
" TODO:
|
||||
" - Class aware completion:
|
||||
@ -72,7 +72,7 @@ function! phpcomplete#CompletePHP(findstart, base)
|
||||
" Complete class name
|
||||
" Internal solution for finding classes in current file.
|
||||
let file = getline(1, '$')
|
||||
call filter(file,
|
||||
call filter(file,
|
||||
\ 'v:val =~ "class\\s\\+[a-zA-Z_\\x7f-\\xff][a-zA-Z_0-9\\x7f-\\xff]*\\s*("')
|
||||
let fnames = join(map(tagfiles(), 'escape(v:val, " \\")'))
|
||||
let jfile = join(file, ' ')
|
||||
@ -153,15 +153,15 @@ function! phpcomplete#CompletePHP(findstart, base)
|
||||
" and ifs. No good solution
|
||||
" Functions declared with public keyword or without any
|
||||
" keyword are public
|
||||
let functions = filter(deepcopy(sccontent),
|
||||
let functions = filter(deepcopy(sccontent),
|
||||
\ 'v:val =~ "^\\s*\\(public\\s\\*\\)\\?function"')
|
||||
let jfuncs = join(functions, ' ')
|
||||
let sfuncs = split(jfuncs, 'function\s\+')
|
||||
let c_functions = {}
|
||||
for i in sfuncs
|
||||
let f_name = matchstr(i,
|
||||
let f_name = matchstr(i,
|
||||
\ '^&\?\zs[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\ze')
|
||||
let f_args = matchstr(i,
|
||||
let f_args = matchstr(i,
|
||||
\ '^&\?[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s*(\zs.\{-}\ze)\_s*{')
|
||||
if f_name != ''
|
||||
let c_functions[f_name.'('] = f_args
|
||||
@ -169,13 +169,13 @@ function! phpcomplete#CompletePHP(findstart, base)
|
||||
endfor
|
||||
" Variables declared with var or with public keyword are
|
||||
" public
|
||||
let variables = filter(deepcopy(sccontent),
|
||||
let variables = filter(deepcopy(sccontent),
|
||||
\ 'v:val =~ "^\\s*\\(public\\|var\\)\\s\\+\\$"')
|
||||
let jvars = join(variables, ' ')
|
||||
let svars = split(jvars, '\$')
|
||||
let c_variables = {}
|
||||
for i in svars
|
||||
let c_var = matchstr(i,
|
||||
let c_var = matchstr(i,
|
||||
\ '^\zs[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\ze')
|
||||
if c_var != ''
|
||||
let c_variables[c_var] = ''
|
||||
@ -204,13 +204,13 @@ function! phpcomplete#CompletePHP(findstart, base)
|
||||
if all_values[i] != ''
|
||||
let class = i.' class '
|
||||
endif
|
||||
let final_list +=
|
||||
\ [{'word':i,
|
||||
\ 'info':class.all_values[i],
|
||||
let final_list +=
|
||||
\ [{'word':i,
|
||||
\ 'info':class.all_values[i],
|
||||
\ 'kind':'v'}]
|
||||
else
|
||||
let final_list +=
|
||||
\ [{'word':substitute(i, '.*::', '', ''),
|
||||
let final_list +=
|
||||
\ [{'word':substitute(i, '.*::', '', ''),
|
||||
\ 'info':i.all_values[i].')',
|
||||
\ 'kind':'f'}]
|
||||
endif
|
||||
@ -241,7 +241,7 @@ function! phpcomplete#CompletePHP(findstart, base)
|
||||
let int_vars[adddollar.val] = ''
|
||||
endif
|
||||
endfor
|
||||
|
||||
|
||||
" ctags has good support for PHP, use tags file for external
|
||||
" variables
|
||||
let fnames = join(map(tagfiles(), 'escape(v:val, " \\")'))
|
||||
@ -256,7 +256,7 @@ function! phpcomplete#CompletePHP(findstart, base)
|
||||
let classname = ''
|
||||
if field['text'] =~ item.'\s*=\s*new\s\+'
|
||||
let item = item.'->'
|
||||
let classname = matchstr(field['text'],
|
||||
let classname = matchstr(field['text'],
|
||||
\ '=\s*new\s\+\zs[a-zA-Z_0-9\x7f-\xff]\+\ze')
|
||||
endif
|
||||
let ext_vars[adddollar.item] = classname
|
||||
@ -268,16 +268,16 @@ function! phpcomplete#CompletePHP(findstart, base)
|
||||
|
||||
" Internal solution for finding functions in current file.
|
||||
let file = getline(1, '$')
|
||||
call filter(file,
|
||||
call filter(file,
|
||||
\ 'v:val =~ "function\\s\\+&\\?[a-zA-Z_\\x7f-\\xff][a-zA-Z_0-9\\x7f-\\xff]*\\s*("')
|
||||
let fnames = join(map(tagfiles(), 'escape(v:val, " \\")'))
|
||||
let jfile = join(file, ' ')
|
||||
let int_values = split(jfile, 'function\s\+')
|
||||
let int_functions = {}
|
||||
for i in int_values
|
||||
let f_name = matchstr(i,
|
||||
let f_name = matchstr(i,
|
||||
\ '^&\?\zs[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\ze')
|
||||
let f_args = matchstr(i,
|
||||
let f_args = matchstr(i,
|
||||
\ '^&\?[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s*(\zs.\{-}\ze)\_s*{')
|
||||
let int_functions[f_name.'('] = f_args.')'
|
||||
endfor
|
||||
@ -291,7 +291,7 @@ function! phpcomplete#CompletePHP(findstart, base)
|
||||
" File name
|
||||
let item = matchstr(field['text'], '^[^[:space:]]\+')
|
||||
let fname = matchstr(field['text'], '\t\zs\f\+\ze')
|
||||
let prototype = matchstr(field['text'],
|
||||
let prototype = matchstr(field['text'],
|
||||
\ 'function\s\+&\?[^[:space:]]\+\s*(\s*\zs.\{-}\ze\s*)\s*{\?')
|
||||
let ext_functions[item.'('] = prototype.') - '.fname
|
||||
endfor
|
||||
@ -320,8 +320,8 @@ function! phpcomplete#CompletePHP(findstart, base)
|
||||
endif
|
||||
let final_list += [{'word':i, 'info':class.all_values[i], 'kind':'v'}]
|
||||
else
|
||||
let final_list +=
|
||||
\ [{'word':substitute(i, '.*::', '', ''),
|
||||
let final_list +=
|
||||
\ [{'word':substitute(i, '.*::', '', ''),
|
||||
\ 'info':i.all_values[i],
|
||||
\ 'kind':'f'}]
|
||||
endif
|
||||
@ -361,10 +361,10 @@ function! phpcomplete#CompletePHP(findstart, base)
|
||||
let int_vars = {}
|
||||
for i in int_vals
|
||||
if i =~ '^\$[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s*=\s*new'
|
||||
let val = matchstr(i,
|
||||
let val = matchstr(i,
|
||||
\ '^\$[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*').'->'
|
||||
else
|
||||
let val = matchstr(i,
|
||||
let val = matchstr(i,
|
||||
\ '^\$[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*')
|
||||
endif
|
||||
if val != ''
|
||||
@ -373,7 +373,7 @@ function! phpcomplete#CompletePHP(findstart, base)
|
||||
endfor
|
||||
|
||||
call extend(int_vars,g:php_builtin_vars)
|
||||
|
||||
|
||||
" ctags has support for PHP, use tags file for external variables
|
||||
let fnames = join(map(tagfiles(), 'escape(v:val, " \\")'))
|
||||
let ext_vars = {}
|
||||
@ -387,7 +387,7 @@ function! phpcomplete#CompletePHP(findstart, base)
|
||||
" Add -> if it is possible object declaration
|
||||
if field['text'] =~ item.'\s*=\s*new\s\+'
|
||||
let item = item.'->'
|
||||
let m_menu = matchstr(field['text'],
|
||||
let m_menu = matchstr(field['text'],
|
||||
\ '=\s*new\s\+\zs[a-zA-Z_0-9\x7f-\xff]\+\ze')
|
||||
endif
|
||||
let ext_vars[item] = m_menu
|
||||
@ -421,7 +421,7 @@ function! phpcomplete#CompletePHP(findstart, base)
|
||||
return int_dict
|
||||
|
||||
else
|
||||
" Complete everything else -
|
||||
" Complete everything else -
|
||||
" + functions, DONE
|
||||
" + keywords of language DONE
|
||||
" + defines (constant definitions), DONE
|
||||
@ -431,16 +431,16 @@ function! phpcomplete#CompletePHP(findstart, base)
|
||||
|
||||
" Internal solution for finding functions in current file.
|
||||
let file = getline(1, '$')
|
||||
call filter(file,
|
||||
call filter(file,
|
||||
\ 'v:val =~ "function\\s\\+&\\?[a-zA-Z_\\x7f-\\xff][a-zA-Z_0-9\\x7f-\\xff]*\\s*("')
|
||||
let fnames = join(map(tagfiles(), 'escape(v:val, " \\")'))
|
||||
let jfile = join(file, ' ')
|
||||
let int_values = split(jfile, 'function\s\+')
|
||||
let int_functions = {}
|
||||
for i in int_values
|
||||
let f_name = matchstr(i,
|
||||
let f_name = matchstr(i,
|
||||
\ '^&\?\zs[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\ze')
|
||||
let f_args = matchstr(i,
|
||||
let f_args = matchstr(i,
|
||||
\ '^&\?[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s*(\s*\zs.\{-}\ze\s*)\_s*{')
|
||||
let int_functions[f_name.'('] = f_args.')'
|
||||
endfor
|
||||
@ -454,7 +454,7 @@ function! phpcomplete#CompletePHP(findstart, base)
|
||||
" File name
|
||||
let item = matchstr(field['text'], '^[^[:space:]]\+')
|
||||
let fname = matchstr(field['text'], '\t\zs\f\+\ze')
|
||||
let prototype = matchstr(field['text'],
|
||||
let prototype = matchstr(field['text'],
|
||||
\ 'function\s\+&\?[^[:space:]]\+\s*(\s*\zs.\{-}\ze\s*)\s*{\?')
|
||||
let ext_functions[item.'('] = prototype.') - '.fname
|
||||
endfor
|
||||
@ -472,7 +472,7 @@ function! phpcomplete#CompletePHP(findstart, base)
|
||||
let int_constants = {}
|
||||
for i in int_values
|
||||
let c_name = matchstr(i, '\(["'']\)\zs[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\ze\1')
|
||||
" let c_value = matchstr(i,
|
||||
" let c_value = matchstr(i,
|
||||
" \ '\(["'']\)[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\1\s*,\s*\zs.\{-}\ze\s*)')
|
||||
if c_name != ''
|
||||
let int_constants[c_name] = '' " c_value
|
||||
@ -516,8 +516,8 @@ function! phpcomplete#CompletePHP(findstart, base)
|
||||
let final_list = []
|
||||
for i in int_list
|
||||
if has_key(int_functions, i)
|
||||
let final_list +=
|
||||
\ [{'word':i,
|
||||
let final_list +=
|
||||
\ [{'word':i,
|
||||
\ 'info':i.int_functions[i],
|
||||
\ 'kind':'f'}]
|
||||
elseif has_key(int_constants, i)
|
||||
@ -599,17 +599,17 @@ endfunction
|
||||
|
||||
function! phpcomplete#GetClassContents(file, name) " {{{
|
||||
let cfile = join(a:file, "\n")
|
||||
" We use new buffer and (later) normal! because
|
||||
" We use new buffer and (later) normal! because
|
||||
" this is the most efficient way. The other way
|
||||
" is to go through the looong string looking for
|
||||
" matching {}
|
||||
" matching {}
|
||||
below 1new
|
||||
0put =cfile
|
||||
call search('class\s\+'.a:name)
|
||||
let cfline = line('.')
|
||||
" Catch extends
|
||||
if getline('.') =~ 'extends'
|
||||
let extends_class = matchstr(getline('.'),
|
||||
let extends_class = matchstr(getline('.'),
|
||||
\ 'class\s\+'.a:name.'\s\+extends\s\+\zs[a-zA-Z_0-9\x7f-\xff]\+\ze')
|
||||
else
|
||||
let extends_class = ''
|
||||
@ -965,8 +965,8 @@ let g:php_keywords = {
|
||||
" PHP builtin functions {{{
|
||||
" To create from scratch list of functions:
|
||||
" 1. Download multi html file PHP documentation
|
||||
" 2. run for i in `ls | grep "^function\."`; do grep -A4 Description $i >> funcs; done
|
||||
" 3. Open funcs in Vim and
|
||||
" 2. run for i in `ls | grep "^function\."`; do grep -A4 Description $i >> funcs; done
|
||||
" 3. Open funcs in Vim and
|
||||
" a) g/Description/normal! 5J
|
||||
" b) remove all html tags (it will require few s/// and g//)
|
||||
" c) :%s/^\([^[:space:]]\+\) \([^[:space:]]\+\) ( \(.*\))/\\ '\2(': '\3| \1',
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
" Vim completion script
|
||||
" Language: XML
|
||||
" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
|
||||
" Last Change: 2006 Apr 19
|
||||
" Last Change: 2006 Apr 30
|
||||
|
||||
" This function will create Dictionary with users namespace strings and values
|
||||
" canonical (system) names of data files. Names should be lowercase,
|
||||
@ -22,7 +22,7 @@ function! xmlcomplete#CreateConnection(canonical, ...) " {{{
|
||||
endif
|
||||
|
||||
" Source data file. Due to suspected errors in autoload do it with
|
||||
" :runtime.
|
||||
" :runtime.
|
||||
" TODO: make it properly (using autoload, that is) later
|
||||
exe "runtime autoload/xml/".a:canonical.".vim"
|
||||
|
||||
@ -166,7 +166,7 @@ function! xmlcomplete#CompleteTags(findstart, base)
|
||||
endif
|
||||
|
||||
" find tags matching with "a:base"
|
||||
" If a:base contains white space it is attribute.
|
||||
" If a:base contains white space it is attribute.
|
||||
" It could be also value of attribute...
|
||||
" We have to get first word to offer
|
||||
" proper completions
|
||||
|
||||
Reference in New Issue
Block a user