summaryrefslogtreecommitdiff
path: root/runtime/autoload
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2006-04-05 20:41:53 +0000
committerBram Moolenaar <Bram@vim.org>2006-04-05 20:41:53 +0000
commit910f66f90c928da8b607ccfdc12fc33d9cb8d4a9 (patch)
tree152a03d1d7ea3e8d433addba4f463d8a7a68a5fd /runtime/autoload
parente2f98b95c8071f772695602cd4f714dc588eb8e7 (diff)
downloadvim-git-910f66f90c928da8b607ccfdc12fc33d9cb8d4a9.tar.gz
updated for version 7.0c10v7.0c10
Diffstat (limited to 'runtime/autoload')
-rw-r--r--runtime/autoload/gzip.vim9
-rw-r--r--runtime/autoload/netrw.vim17
-rw-r--r--runtime/autoload/phpcomplete.vim846
-rw-r--r--runtime/autoload/sqlcomplete.vim154
-rw-r--r--runtime/autoload/tar.vim62
-rw-r--r--runtime/autoload/vimball.vim8
-rw-r--r--runtime/autoload/xmlcomplete.vim13
-rw-r--r--runtime/autoload/zip.vim31
8 files changed, 722 insertions, 418 deletions
diff --git a/runtime/autoload/gzip.vim b/runtime/autoload/gzip.vim
index a6467b8f6..f6f7bc41d 100644
--- a/runtime/autoload/gzip.vim
+++ b/runtime/autoload/gzip.vim
@@ -1,6 +1,6 @@
" Vim autoload file for editing compressed files.
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2005 Jul 26
+" Last Change: 2006 Mar 31
" These functions are used by the gzip plugin.
@@ -84,9 +84,14 @@ fun gzip#read(cmd)
'[,']d _
endif
" read in the uncompressed lines "'[-1r tmp"
+ " Use ++edit if the buffer was empty, keep the 'ff' and 'fenc' options.
setlocal nobin
if exists(":lockmarks")
- execute "silent lockmarks " . l . "r " . tmp
+ if empty
+ execute "silent lockmarks " . l . "r ++edit " . tmp
+ else
+ execute "silent lockmarks " . l . "r " . tmp
+ endif
else
execute "silent " . l . "r " . tmp
endif
diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim
index 399f671e0..00a3f3e87 100644
--- a/runtime/autoload/netrw.vim
+++ b/runtime/autoload/netrw.vim
@@ -1,7 +1,7 @@
" netrw.vim: Handles file transfer and remote directory listing across a network
" AUTOLOAD PORTION
-" Date: Mar 22, 2006
-" Version: 83
+" Date: Mar 31, 2006
+" Version: 84
" Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz>
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
" Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. {{{1
@@ -23,7 +23,7 @@
if &cp || exists("g:loaded_netrw")
finish
endif
-let g:loaded_netrw = "v83"
+let g:loaded_netrw = "v84"
if v:version < 700
echohl WarningMsg | echo "***netrw*** you need vim version 7.0 or later for version ".g:loaded_netrw." of netrw" | echohl None
finish
@@ -404,8 +404,9 @@ fun! netrw#NetRead(mode,...)
call s:NetMethod(choice)
" Check if NetBrowse() should be handling this request
-" call Decho("checking if netlist: choice<".choice."> netrw_list_cmd<".g:netrw_list_cmd.">")
+" call Decho("checking if NetBrowse() should handle choice<".choice."> with netrw_list_cmd<".g:netrw_list_cmd.">")
if choice =~ "^.*[\/]$"
+" call Decho("yes, choice matches '^.*[\/]$'")
keepjumps call s:NetBrowse(choice)
" call Dret("NetRead")
return
@@ -457,6 +458,7 @@ fun! netrw#NetRead(mode,...)
elseif b:netrw_method == 2 " read with ftp + <.netrc>
" call Decho("read via ftp+.netrc (method #2)")
let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
+" call Decho("netrw_fname<".netrw_fname.">")
new
setlocal ff=unix
exe "put ='".g:netrw_ftpmode."'"
@@ -780,7 +782,7 @@ fun! s:NetGetFile(readcmd, tfile, method)
" call Decho("calling NetReadFixup(method<".a:method."> line1=".line1." line2=".line2.")")
call NetReadFixup(a:method, line1, line2)
" else " Decho
-" call Decho("NetReadFixup() not called, doesn't exist")
+" call Decho("NetReadFixup() not called, doesn't exist (line1=".line1." line2=".line2.")")
endif
" update the Buffers menu
@@ -1239,7 +1241,6 @@ fun! s:NetBrowse(dirname)
exe "silent doau BufReadPre ".fname
silent call netrw#NetRead(2,method."://".user.machine."/".path)
exe "silent doau BufReadPost ".fname
- keepjumps 1d
" save certain window-oriented variables into buffer-oriented variables
call s:SetBufWinVars()
@@ -1352,7 +1353,7 @@ fun! s:NetBrowse(dirname)
endif
let w:netrw_bannercnt= w:netrw_bannercnt + 1
endif
- keepjumps put ='\" Quick Help: ?:help -:go up dir D:delete R:rename s:sort-by x:exec'
+ keepjumps put ='\" Quick Help: <F1>:help -:go up dir D:delete R:rename s:sort-by x:exec'
keepjumps put ='\" ==========================================================================='
" remote read the requested directory listing
@@ -2943,7 +2944,7 @@ fun! netrw#DirBrowse(dirname)
endif
let w:netrw_bannercnt= w:netrw_bannercnt + 1
endif
- keepjumps put ='\" Quick Help: ?:help -:go up dir D:delete R:rename s:sort-by x:exec'
+ keepjumps put ='\" Quick Help: <F1>:help -:go up dir D:delete R:rename s:sort-by x:exec'
keepjumps put ='\" ============================================================================'
let w:netrw_bannercnt= w:netrw_bannercnt + 2
diff --git a/runtime/autoload/phpcomplete.vim b/runtime/autoload/phpcomplete.vim
index 4d448dc2b..8cb4db036 100644
--- a/runtime/autoload/phpcomplete.vim
+++ b/runtime/autoload/phpcomplete.vim
@@ -1,7 +1,7 @@
" Vim completion script
" Language: PHP
" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
-" Last Change: 2006 Mar ---
+" Last Change: 2006 Apr 05
"
" TODO:
" - Class aware completion:
@@ -47,400 +47,594 @@ function! phpcomplete#CompletePHP(findstart, base)
" We can be also inside of phpString with HTML tags. Deal with
" it later (time, not lines).
endif
- else
- " If exists b:php_menu it means completion was already constructed we
- " don't need to do anything more
- if exists("b:php_menu")
- return b:php_menu
- endif
- " Initialize base return lists
- let res = []
- " a:base is very short - we need context
- if exists("b:compl_context")
- let context = b:compl_context
- unlet! b:compl_context
- endif
- if !exists('g:php_builtin_functions')
- call phpcomplete#LoadData()
- endif
+ endif
+ " If exists b:php_menu it means completion was already constructed we
+ " don't need to do anything more
+ if exists("b:php_menu")
+ return b:php_menu
+ endif
+ " Initialize base return lists
+ let res = []
+ let res2 = []
+ " a:base is very short - we need context
+ if exists("b:compl_context")
+ let context = b:compl_context
+ unlet! b:compl_context
+ endif
- let scontext = substitute(context,
- \ '\$\?[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*$', '', '')
+ if !exists('g:php_builtin_functions')
+ call phpcomplete#LoadData()
+ endif
- if scontext =~ '\(=\s*new\|extends\)\s\+$'
- " Complete class name
- " Internal solution for finding classes in current file.
- let file = getline(1, '$')
- 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, ' ')
- let int_values = split(jfile, 'class\s\+')
- let int_classes = {}
- for i in int_values
- let c_name = matchstr(i, '^[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*')
- if c_name != ''
- let int_classes[c_name] = ''
- endif
+ let scontext = substitute(context, '\$\?[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*$', '', '')
+
+ if scontext =~ '\(=\s*new\|extends\)\s\+$'
+ " Complete class name
+ " Internal solution for finding classes in current file.
+ let file = getline(1, '$')
+ 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, ' ')
+ let int_values = split(jfile, 'class\s\+')
+ let int_classes = {}
+ for i in int_values
+ let c_name = matchstr(i, '^[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*')
+ if c_name != ''
+ let int_classes[c_name] = ''
+ endif
+ endfor
+
+ " Prepare list of functions from tags file
+ let ext_classes = {}
+ let fnames = join(map(tagfiles(), 'escape(v:val, " \\")'))
+ if fnames != ''
+ exe 'silent! vimgrep /^'.a:base.'.*\tc\(\t\|$\)/j '.fnames
+ let qflist = getqflist()
+ for field in qflist
+ " [:space:] thing: we don't have to be so strict when
+ " dealing with tags files - entries there were already
+ " checked by ctags.
+ let item = matchstr(field['text'], '^[^[:space:]]\+')
+ let ext_classes[item] = ''
endfor
+ endif
- " Prepare list of functions from tags file
- let ext_classes = {}
- let fnames = join(map(tagfiles(), 'escape(v:val, " \\")'))
- if fnames != ''
- exe 'silent! vimgrep /^'.a:base.'.*\tc\(\t\|$\)/j '.fnames
- let qflist = getqflist()
- for field in qflist
- " [:space:] thing: we don't have to be so strict when
- " dealing with tags files - entries there were already
- " checked by ctags.
- let item = matchstr(field['text'], '^[^[:space:]]\+')
- let ext_classes[item] = ''
- endfor
+ call extend(int_classes, ext_classes)
+
+ for m in sort(keys(int_classes))
+ if m =~ '^'.a:base
+ call add(res, m)
endif
+ endfor
- call extend(int_classes, ext_classes)
+ let int_list = res
- for m in sort(keys(int_classes))
- if m =~ '^'.a:base
- call add(res, m)
- endif
- endfor
+ let final_menu = []
+ for i in int_list
+ let final_menu += [{'word':i, 'kind':'c'}]
+ endfor
- let int_list = res
+ return final_menu
- let final_menu = []
- for i in int_list
- let final_menu += [{'word':i, 'kind':'c'}]
- endfor
+ elseif scontext =~ '\(->\|::\)$'
+ " Complete user functions and variables
+ " Internal solution for current file.
+ " That seems as unnecessary repeating of functions but there are
+ " few not so subtle differences as not appending of $ and addition
+ " of 'kind' tag (not necessary in regular completion)
- return final_menu
+ if scontext =~ '->$' && scontext !~ '\$this->$'
- elseif scontext =~ '\(->\|::\)$'
- " Complete user functions and variables
- " Internal solution for current file.
- " That seems as unnecessary repeating of functions but there are
- " few not so subtle differences as not appending of $ and addition
- " of 'kind' tag (not necessary in regular completion)
- if a:base =~ '^\$'
- let adddollar = '$'
+ " Get name of the class
+ let classname = phpcomplete#GetClassName(scontext)
+
+ " Get location of class definition, we have to iterate through all
+ " tags files separately because we need relative path from current
+ " file to the exact file (tags file can be in different dir)
+ if classname != ''
+ let classlocation = phpcomplete#GetClassLocation(classname)
else
- let adddollar = ''
+ let classlocation = ''
endif
- let file = getline(1, '$')
- let jfile = join(file, ' ')
- let sfile = split(jfile, '\$')
- let int_vars = {}
- for i in sfile
- if i =~ '^\$[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s*=\s*new'
- let val = matchstr(i, '^[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*').'->'
- else
- let val = matchstr(i, '^[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*')
- endif
- if val !~ ''
- 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, " \\")'))
- let ext_vars = {}
- if fnames != ''
- let sbase = substitute(a:base, '^\$', '', '')
- exe 'silent! vimgrep /^'.sbase.'.*\tv\(\t\|$\)/j '.fnames
- let qflist = getqflist()
- for field in qflist
- let item = matchstr(field['text'], '^[^[:space:]]\+')
- " Add -> if it is possible object declaration
- let classname = ''
- if field['text'] =~ item.'\s*=\s*new\s\+'
- let item = item.'->'
- let classname = matchstr(field['text'],
- \ '=\s*new\s\+\zs[a-zA-Z_0-9\x7f-\xff]\+\ze')
+
+ if filereadable(classlocation)
+ let classfile = readfile(classlocation)
+ let classcontent = ''
+ let classcontent .= "\n".phpcomplete#GetClassContents(classfile, classname)
+ let sccontent = split(classcontent, "\n")
+
+ " YES, YES, YES! - we have whole content including extends!
+ " Now we need to get two elements: public functions and public
+ " vars
+ " NO, NO, NO! - third separate filtering looking for content
+ " :(, but all of them have differences. To squeeze them into
+ " one implementation would require many additional arguments
+ " and ifs. No good solution
+ " Functions declared with public keyword or without any
+ " keyword are public
+ 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,
+ \ '^&\?\zs[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\ze')
+ 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
+ endif
+ endfor
+ " Variables declared with var or with public keyword are
+ " public
+ 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,
+ \ '^\zs[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\ze')
+ if c_var != ''
+ let c_variables[c_var] = ''
endif
- let ext_vars[adddollar.item] = classname
endfor
- endif
- " Now we have all variables in int_vars dictionary
- call extend(int_vars, ext_vars)
+ let all_values = {}
+ call extend(all_values, c_functions)
+ call extend(all_values, c_variables)
+ call extend(all_values, g:php_builtin_object_functions)
- " Internal solution for finding functions in current file.
- let file = getline(1, '$')
- 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,
- \ '^&\?\zs[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\ze')
- 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
+ for m in sort(keys(all_values))
+ if m =~ '^'.a:base && m !~ '::'
+ call add(res, m)
+ elseif m =~ '::'.a:base
+ call add(res2, m)
+ endif
+ endfor
- " Prepare list of functions from tags file
- let ext_functions = {}
- if fnames != ''
- exe 'silent! vimgrep /^'.a:base.'.*\tf\(\t\|$\)/j '.fnames
- let qflist = getqflist()
- for field in qflist
- " File name
- let item = matchstr(field['text'], '^[^[:space:]]\+')
- let fname = matchstr(field['text'], '\t\zs\f\+\ze')
- let prototype = matchstr(field['text'],
- \ 'function\s\+&\?[^[:space:]]\+\s*(\s*\zs.\{-}\ze\s*)\s*{\?')
- let ext_functions[item.'('] = prototype.') - '.fname
+ let start_list = res + res2
+
+ let final_list = []
+ for i in start_list
+ if has_key(c_variables, i)
+ let class = ' '
+ if all_values[i] != ''
+ let class = i.' class '
+ endif
+ let final_list +=
+ \ [{'word':i,
+ \ 'info':class.all_values[i],
+ \ 'kind':'v'}]
+ else
+ let final_list +=
+ \ [{'word':substitute(i, '.*::', '', ''),
+ \ 'info':i.all_values[i].')',
+ \ 'kind':'f'}]
+ endif
endfor
+
+ return final_list
+
endif
- let all_values = {}
- call extend(all_values, int_functions)
- call extend(all_values, ext_functions)
- call extend(all_values, int_vars) " external variables are already in
- call extend(all_values, g:php_builtin_object_functions)
+ endif
- for m in sort(keys(all_values))
- if m =~ '\(^\|::\)'.a:base
- call add(res, m)
+ if a:base =~ '^\$'
+ let adddollar = '$'
+ else
+ let adddollar = ''
+ endif
+ let file = getline(1, '$')
+ let jfile = join(file, ' ')
+ let sfile = split(jfile, '\$')
+ let int_vars = {}
+ for i in sfile
+ if i =~ '^\$[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s*=\s*new'
+ let val = matchstr(i, '^[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*').'->'
+ else
+ let val = matchstr(i, '^[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*')
+ endif
+ if val !~ ''
+ 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, " \\")'))
+ let ext_vars = {}
+ if fnames != ''
+ let sbase = substitute(a:base, '^\$', '', '')
+ exe 'silent! vimgrep /^'.sbase.'.*\tv\(\t\|$\)/j '.fnames
+ let qflist = getqflist()
+ for field in qflist
+ let item = matchstr(field['text'], '^[^[:space:]]\+')
+ " Add -> if it is possible object declaration
+ let classname = ''
+ if field['text'] =~ item.'\s*=\s*new\s\+'
+ let item = item.'->'
+ let classname = matchstr(field['text'],
+ \ '=\s*new\s\+\zs[a-zA-Z_0-9\x7f-\xff]\+\ze')
endif
+ let ext_vars[adddollar.item] = classname
endfor
+ endif
- let start_list = res
+ " Now we have all variables in int_vars dictionary
+ call extend(int_vars, ext_vars)
- let final_list = []
- for i in start_list
- if has_key(int_vars, i)
- let class = ' '
- if all_values[i] != ''
- let class = i.' class '
- endif
- let final_list += [{'word':i, 'info':class.all_values[i], 'kind':'v'}]
- else
- let final_list +=
- \ [{'word':substitute(i, '.*::', '', ''),
- \ 'info':i.all_values[i],
- \ 'kind':'f'}]
- endif
- endfor
+ " Internal solution for finding functions in current file.
+ let file = getline(1, '$')
+ 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,
+ \ '^&\?\zs[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\ze')
+ 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
- return final_list
+ " Prepare list of functions from tags file
+ let ext_functions = {}
+ if fnames != ''
+ exe 'silent! vimgrep /^'.a:base.'.*\tf\(\t\|$\)/j '.fnames
+ let qflist = getqflist()
+ for field in qflist
+ " File name
+ let item = matchstr(field['text'], '^[^[:space:]]\+')
+ let fname = matchstr(field['text'], '\t\zs\f\+\ze')
+ let prototype = matchstr(field['text'],
+ \ 'function\s\+&\?[^[:space:]]\+\s*(\s*\zs.\{-}\ze\s*)\s*{\?')
+ let ext_functions[item.'('] = prototype.') - '.fname
+ endfor
endif
- if a:base =~ '^\$'
- " Complete variables
- " Built-in variables {{{
- let g:php_builtin_vars = {'$GLOBALS':'',
- \ '$_SERVER':'',
- \ '$_GET':'',
- \ '$_POST':'',
- \ '$_COOKIE':'',
- \ '$_FILES':'',
- \ '$_ENV':'',
- \ '$_REQUEST':'',
- \ '$_SESSION':'',
- \ '$HTTP_SERVER_VARS':'',
- \ '$HTTP_ENV_VARS':'',
- \ '$HTTP_COOKIE_VARS':'',
- \ '$HTTP_GET_VARS':'',
- \ '$HTTP_POST_VARS':'',
- \ '$HTTP_POST_FILES':'',
- \ '$HTTP_SESSION_VARS':'',
- \ '$php_errormsg':'',
- \ '$this':''
- \ }
- " }}}
+ let all_values = {}
+ call extend(all_values, int_functions)
+ call extend(all_values, ext_functions)
+ call extend(all_values, int_vars) " external variables are already in
+ call extend(all_values, g:php_builtin_object_functions)
- " Internal solution for current file.
- let file = getline(1, '$')
- let jfile = join(file, ' ')
- let int_vals = split(jfile, '\ze\$')
- 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,
- \ '^\$[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*').'->'
- else
- let val = matchstr(i,
- \ '^\$[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*')
- endif
- if val != ''
- let int_vars[val] = ''
- endif
- endfor
+ for m in sort(keys(all_values))
+ if m =~ '\(^\|::\)'.a:base
+ call add(res, m)
+ endif
+ endfor
- call extend(int_vars,g:php_builtin_vars)
-
- " ctags has good support for PHP, use tags file for external
- " variables
- let fnames = join(map(tagfiles(), 'escape(v:val, " \\")'))
- let ext_vars = {}
- if fnames != ''
- let sbase = substitute(a:base, '^\$', '', '')
- exe 'silent! vimgrep /^'.sbase.'.*\tv\(\t\|$\)/j '.fnames
- let qflist = getqflist()
- for field in qflist
- let item = '$'.matchstr(field['text'], '^[^[:space:]]\+')
- let m_menu = ''
- " Add -> if it is possible object declaration
- " How to detect if previous line is help line?
- if field['text'] =~ item.'\s*=\s*new\s\+'
- let item = item.'->'
- 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
- endfor
+ let start_list = res
+
+ let final_list = []
+ for i in start_list
+ if has_key(int_vars, i)
+ let class = ' '
+ if all_values[i] != ''
+ let class = i.' class '
+ endif
+ let final_list += [{'word':i, 'info':class.all_values[i], 'kind':'v'}]
+ else
+ let final_list +=
+ \ [{'word':substitute(i, '.*::', '', ''),
+ \ 'info':i.all_values[i],
+ \ 'kind':'f'}]
endif
+ endfor
+
+ return final_list
+ endif
- call extend(int_vars, ext_vars)
- let g:a0 = keys(int_vars)
+ if a:base =~ '^\$'
+ " Complete variables
+ " Built-in variables {{{
+ let g:php_builtin_vars = {'$GLOBALS':'',
+ \ '$_SERVER':'',
+ \ '$_GET':'',
+ \ '$_POST':'',
+ \ '$_COOKIE':'',
+ \ '$_FILES':'',
+ \ '$_ENV':'',
+ \ '$_REQUEST':'',
+ \ '$_SESSION':'',
+ \ '$HTTP_SERVER_VARS':'',
+ \ '$HTTP_ENV_VARS':'',
+ \ '$HTTP_COOKIE_VARS':'',
+ \ '$HTTP_GET_VARS':'',
+ \ '$HTTP_POST_VARS':'',
+ \ '$HTTP_POST_FILES':'',
+ \ '$HTTP_SESSION_VARS':'',
+ \ '$php_errormsg':'',
+ \ '$this':''
+ \ }
+ " }}}
+
+ " Internal solution for current file.
+ let file = getline(1, '$')
+ let jfile = join(file, ' ')
+ let int_vals = split(jfile, '\ze\$')
+ 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,
+ \ '^\$[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*').'->'
+ else
+ let val = matchstr(i,
+ \ '^\$[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*')
+ endif
+ if val != ''
+ let int_vars[val] = ''
+ endif
+ endfor
- for m in sort(keys(int_vars))
- if m =~ '^\'.a:base
- call add(res, m)
+ 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 = {}
+ if fnames != ''
+ let sbase = substitute(a:base, '^\$', '', '')
+ exe 'silent! vimgrep /^'.sbase.'.*\tv\(\t\|$\)/j '.fnames
+ let qflist = getqflist()
+ for field in qflist
+ let item = '$'.matchstr(field['text'], '^[^[:space:]]\+')
+ let m_menu = ''
+ " Add -> if it is possible object declaration
+ if field['text'] =~ item.'\s*=\s*new\s\+'
+ let item = item.'->'
+ 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
endfor
+ endif
- let int_list = res
+ call extend(int_vars, ext_vars)
+ let g:a0 = keys(int_vars)
+
+ for m in sort(keys(int_vars))
+ if m =~ '^\'.a:base
+ call add(res, m)
+ endif
+ endfor
- let int_dict = []
- for i in int_list
+ let int_list = res
+
+ let int_dict = []
+ for i in int_list
+ if int_vars[i] != ''
+ let class = ' '
if int_vars[i] != ''
- let class = ' '
- if int_vars[i] != ''
- let class = i.' class '
- endif
- let int_dict += [{'word':i, 'info':class.int_vars[i], 'kind':'v'}]
- else
- let int_dict += [{'word':i, 'kind':'v'}]
+ let class = i.' class '
endif
- endfor
+ let int_dict += [{'word':i, 'info':class.int_vars[i], 'kind':'v'}]
+ else
+ let int_dict += [{'word':i, 'kind':'v'}]
+ endif
+ endfor
- return int_dict
+ return int_dict
- else
- " Complete everything else -
- " + functions, DONE
- " + keywords of language DONE
- " + defines (constant definitions), DONE
- " + extend keywords for predefined constants, DONE
- " + classes (after new), DONE
- " + limit choice after -> and :: to funcs and vars DONE
+ else
+ " Complete everything else -
+ " + functions, DONE
+ " + keywords of language DONE
+ " + defines (constant definitions), DONE
+ " + extend keywords for predefined constants, DONE
+ " + classes (after new), DONE
+ " + limit choice after -> and :: to funcs and vars DONE
- " Internal solution for finding functions in current file.
- let file = getline(1, '$')
- 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,
- \ '^&\?\zs[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\ze')
- 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.')'
+ " Internal solution for finding functions in current file.
+ let file = getline(1, '$')
+ 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,
+ \ '^&\?\zs[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\ze')
+ 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
+
+ " Prepare list of functions from tags file
+ let ext_functions = {}
+ if fnames != ''
+ exe 'silent! vimgrep /^'.a:base.'.*\tf\(\t\|$\)/j '.fnames
+ let qflist = getqflist()
+ for field in qflist
+ " File name
+ let item = matchstr(field['text'], '^[^[:space:]]\+')
+ let fname = matchstr(field['text'], '\t\zs\f\+\ze')
+ let prototype = matchstr(field['text'],
+ \ 'function\s\+&\?[^[:space:]]\+\s*(\s*\zs.\{-}\ze\s*)\s*{\?')
+ let ext_functions[item.'('] = prototype.') - '.fname
endfor
+ endif
- " Prepare list of functions from tags file
- let ext_functions = {}
- if fnames != ''
- exe 'silent! vimgrep /^'.a:base.'.*\tf\(\t\|$\)/j '.fnames
- let qflist = getqflist()
- for field in qflist
- " File name
- let item = matchstr(field['text'], '^[^[:space:]]\+')
- let fname = matchstr(field['text'], '\t\zs\f\+\ze')
- let prototype = matchstr(field['text'],
- \ 'function\s\+&\?[^[:space:]]\+\s*(\s*\zs.\{-}\ze\s*)\s*{\?')
- let ext_functions[item.'('] = prototype.') - '.fname
- endfor
- endif
+ " All functions
+ call extend(int_functions, ext_functions)
+ call extend(int_functions, g:php_builtin_functions)
- " All functions
- call extend(int_functions, ext_functions)
- call extend(int_functions, g:php_builtin_functions)
+ " Internal solution for finding constants in current file
+ let file = getline(1, '$')
+ call filter(file, 'v:val =~ "define\\s*("')
+ let jfile = join(file, ' ')
+ let int_values = split(jfile, 'define\s*(\s*')
+ 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,
+ " \ '\(["'']\)[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
+ endif
+ endfor
- " Internal solution for finding constants in current file
- let file = getline(1, '$')
- call filter(file, 'v:val =~ "define\\s*("')
- let jfile = join(file, ' ')
- let int_values = split(jfile, 'define\s*(\s*')
- 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,
- " \ '\(["'']\)[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
- endif
+ " Prepare list of constants from tags file
+ let fnames = join(map(tagfiles(), 'escape(v:val, " \\")'))
+ let ext_constants = {}
+ if fnames != ''
+ exe 'silent! vimgrep /^'.a:base.'.*\td\(\t\|$\)/j '.fnames
+ let qflist = getqflist()
+ for field in qflist
+ let item = matchstr(field['text'], '^[^[:space:]]\+')
+ let ext_constants[item] = ''
endfor
+ endif
- " Prepare list of constants from tags file
- let fnames = join(map(tagfiles(), 'escape(v:val, " \\")'))
- let ext_constants = {}
- if fnames != ''
- exe 'silent! vimgrep /^'.a:base.'.*\td\(\t\|$\)/j '.fnames
- let qflist = getqflist()
- for field in qflist
- let item = matchstr(field['text'], '^[^[:space:]]\+')
- let ext_constants[item] = ''
- endfor
+ " All constants
+ call extend(int_constants, ext_constants)
+ " Treat keywords as constants
+
+ let all_values = {}
+
+ " One big dictionary of functions
+ call extend(all_values, int_functions)
+
+ " Add constants
+ call extend(all_values, int_constants)
+ " Add keywords
+ call extend(all_values, g:php_keywords)
+
+ for m in sort(keys(all_values))
+ if m =~ '^'.a:base
+ call add(res, m)
endif
+ endfor
- " All constants
- call extend(int_constants, ext_constants)
- " Treat keywords as constants
+ let int_list = res
- let all_values = {}
+ let final_list = []
+ for i in int_list
+ if has_key(int_functions, i)
+ let final_list +=
+ \ [{'word':i,
+ \ 'info':i.int_functions[i],
+ \ 'kind':'f'}]
+ elseif has_key(int_constants, i)
+ let final_list += [{'word':i, 'kind':'d'}]
+ else
+ let final_list += [{'word':i}]
+ endif
+ endfor
- " One big dictionary of functions
- call extend(all_values, int_functions)
+ return final_list
- " Add constants
- call extend(all_values, int_constants)
- " Add keywords
- call extend(all_values, b:php_keywords)
+ endif
- for m in sort(keys(all_values))
- if m =~ '^'.a:base
- call add(res, m)
- endif
- endfor
+endfunction
- let int_list = res
+function! phpcomplete#GetClassName(scontext) " {{{
+ " Get class name
+ " Class name can be detected in few ways:
+ " @var $myVar class
+ " line above
+ " or line in tags file
- let final_list = []
- for i in int_list
- if has_key(int_functions, i)
- let final_list +=
- \ [{'word':i,
- \ 'info':i.int_functions[i],
- \ 'kind':'f'}]
- elseif has_key(int_constants, i)
- let final_list += [{'word':i, 'kind':'d'}]
- else
- let final_list += [{'word':i}]
- endif
- endfor
+ let object = matchstr(a:scontext, '\zs[a-zA-Z_0-9\x7f-\xff]\+\ze->')
+ let i = 1
+ while i < line('.')
+ let line = getline(line('.')-i)
+ if line =~ '^\s*\*\/\?\s*$'
+ let i += 1
+ continue
+ else
+ if line =~ '@var\s\+\$'.object.'\s\+[a-zA-Z_0-9\x7f-\xff]\+'
+ let classname = matchstr(line, '@var\s\+\$'.object.'\s\+\zs[a-zA-Z_0-9\x7f-\xff]\+')
+ return classname
+ else
+ break
+ endif
+ endif
+ endwhile
- return final_list
+ " OK, first way failed, now check tags file(s)
+ let fnames = join(map(tagfiles(), 'escape(v:val, " \\")'))
+ exe 'silent! vimgrep /^'.object.'.*\$'.object.'.*=\s*new\s\+.*\tv\(\t\|$\)/j '.fnames
+ let qflist = getqflist()
+ if len(qflist) == 0
+ return []
+ endif
+ " In all properly managed projects it should be one item list, even if it
+ " *is* longer we cannot solve conflicts, assume it is first element
+ let classname = matchstr(qflist[0]['text'], '=\s*new\s\+\zs[a-zA-Z_0-9\x7f-\xff]\+\ze')
+ return classname
+endfunction
+" }}}
+function! phpcomplete#GetClassLocation(classname) " {{{
+ " Get class location
+ for fname in tagfiles()
+ let fhead = fnamemodify(fname, ":h")
+ if fhead != ''
+ let psep = '/'
+ let fhead .= psep
+ endif
+ let fname = escape(fname, " \\")
+ exe 'silent! vimgrep /^'.a:classname.'.*\tc\(\t\|$\)/j '.fname
+ let qflist = getqflist()
+ " As in GetClassName we can manage only one element
+ let classlocation = matchstr(qflist[0]['text'], '\t\zs\f\+\ze\t')
+ " And only one class location
+ if classlocation != ''
+ let pset = '/' " Note: slash is potential problem!
+ let classlocation = fhead.classlocation
+ return classlocation
endif
+ endfor
+
+endfunction
+" }}}
+function! phpcomplete#GetClassContents(file, name) " {{{
+ let cfile = join(a:file, "\n")
+ " 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 {}
+ below 1new
+ 0put =cfile
+ call search('class\s\+'.a:name)
+ let cfline = line('.')
+ " Catch extends
+ if getline('.') =~ 'extends'
+ 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 = ''
+ endif
+ normal! %
+ let classc = getline(cfline, ".")
+ let classcontent = join(classc, "\n")
+
+ bw! %
+ if extends_class != ''
+ let classlocation = phpcomplete#GetClassLocation(extends_class)
+ if filereadable(classlocation)
+ let classfile = readfile(classlocation)
+ let classcontent .= "\n".phpcomplete#GetClassContents(classfile, extends_class)
+ endif
endif
+
+ return classcontent
endfunction
+" }}}
function! phpcomplete#LoadData() " {{{
" Keywords/reserved words, all other special things {{{
" Later it is possible to add some help to values, or type of
" defined variable
-let b:php_keywords = {
+let g:php_keywords = {
\ 'PHP_SELF':'',
\ 'argv':'',
\ 'argc':'',
diff --git a/runtime/autoload/sqlcomplete.vim b/runtime/autoload/sqlcomplete.vim
index 123f0049f..b0415bc15 100644
--- a/runtime/autoload/sqlcomplete.vim
+++ b/runtime/autoload/sqlcomplete.vim
@@ -1,8 +1,8 @@
" Vim completion script
" Language: SQL
" Maintainer: David Fishburn <fishburn@ianywhere.com>
-" Version: 1.0
-" Last Change: Tue Mar 28 2006 4:39:49 PM
+" Version: 2.0
+" Last Change: Mon Apr 03 2006 10:21:36 PM
" Set completion with CTRL-X CTRL-O to autoloaded function.
" This check is in place in case this script is
@@ -21,20 +21,20 @@ endif
let g:loaded_sql_completion = 1
" Maintains filename of dictionary
-let s:sql_file_table = ""
-let s:sql_file_procedure = ""
-let s:sql_file_view = ""
+let s:sql_file_table = ""
+let s:sql_file_procedure = ""
+let s:sql_file_view = ""
" Define various arrays to be used for caching
-let s:tbl_name = []
-let s:tbl_alias = []
-let s:tbl_cols = []
-let s:syn_list = []
-let s:syn_value = []
+let s:tbl_name = []
+let s:tbl_alias = []
+let s:tbl_cols = []
+let s:syn_list = []
+let s:syn_value = []
" Used in conjunction with the syntaxcomplete plugin
-let s:save_inc = ""
-let s:save_exc = ""
+let s:save_inc = ""
+let s:save_exc = ""
if exists('g:omni_syntax_group_include_sql')
let s:save_inc = g:omni_syntax_group_include_sql
endif
@@ -43,12 +43,23 @@ if exists('g:omni_syntax_group_exclude_sql')
endif
" Used with the column list
-let s:save_prev_table = ""
+let s:save_prev_table = ""
" Default the option to verify table alias
if !exists('g:omni_sql_use_tbl_alias')
let g:omni_sql_use_tbl_alias = 'a'
endif
+" Default syntax items to precache
+if !exists('g:omni_sql_precache_syntax_groups')
+ let g:omni_sql_precache_syntax_groups = [
+ \ 'syntax',
+ \ 'sqlKeyword',
+ \ 'sqlFunction',
+ \ 'sqlOption',
+ \ 'sqlType',
+ \ 'sqlStatement'
+ \ ]
+endif
" This function is used for the 'omnifunc' option.
function! sqlcomplete#Complete(findstart, base)
@@ -60,6 +71,8 @@ function! sqlcomplete#Complete(findstart, base)
let compl_type = b:sql_compl_type
endif
+ " First pass through this function determines how much of the line should
+ " be replaced by whatever is chosen from the completion list
if a:findstart
" Locate the start of the item, including "."
let line = getline('.')
@@ -68,15 +81,16 @@ function! sqlcomplete#Complete(findstart, base)
while start > 0
if line[start - 1] =~ '\w'
let start -= 1
- elseif line[start - 1] =~ '\.' && compl_type =~ 'column\|table'
- " If the completion type is table or column
- " Then assume we are looking for column completion
- " column_type can be either 'column' or 'column_csv'
- if lastword == -1
+ elseif line[start - 1] =~ '\.' && compl_type =~ 'column'
+ " If the completion type is column then assume we are looking
+ " for column completion column_type can be either
+ " 'column' or 'column_csv'
+ if lastword == -1 && compl_type == 'column'
+ " Do not replace the table name prefix or alias
+ " if completing only a single column name
let lastword = start
endif
let start -= 1
- let b:sql_compl_type = 'column'
else
break
endif
@@ -92,8 +106,12 @@ function! sqlcomplete#Complete(findstart, base)
return lastword
endif
+ " Second pass through this function will determine what data to put inside
+ " of the completion list
+ " s:prepended is set by the first pass
let base = s:prepended . a:base
+ " Default the completion list to an empty list
let compl_list = []
" Default to table name completion
@@ -178,36 +196,8 @@ function! sqlcomplete#Complete(findstart, base)
let s:tbl_cols = []
let s:syn_list = []
let s:syn_value = []
- return []
else
- " Default to empty or not found
- let compl_list = []
- " Check if we have already cached the syntax list
- let list_idx = index(s:syn_list, compl_type, 0, &ignorecase)
- if list_idx > -1
- " Return previously cached value
- let compl_list = s:syn_value[list_idx]
- else
- " Request the syntax list items from the
- " syntax completion plugin
- if compl_type == 'syntax'
- " Handle this special case. This allows the user
- " to indicate they want all the syntax items available,
- " so do not specify a specific include list.
- let g:omni_syntax_group_include_sql = ''
- else
- " The user has specified a specific syntax group
- let g:omni_syntax_group_include_sql = compl_type
- endif
- let g:omni_syntax_group_exclude_sql = ''
- let syn_value = OmniSyntaxList()
- let g:omni_syntax_group_include_sql = s:save_inc
- let g:omni_syntax_group_exclude_sql = s:save_exc
- " Cache these values for later use
- let s:syn_list = add( s:syn_list, compl_type )
- let s:syn_value = add( s:syn_value, syn_value )
- let compl_list = syn_value
- endif
+ let compl_list = s:SQLCGetSyntaxList(compl_type)
endif
if base != ''
@@ -217,6 +207,10 @@ function! sqlcomplete#Complete(findstart, base)
let compl_list = filter(copy(compl_list), expr)
endif
+ if exists('b:sql_compl_savefunc') && b:sql_compl_savefunc != ""
+ let &omnifunc = b:sql_compl_savefunc
+ endif
+
return compl_list
endfunc
@@ -232,6 +226,70 @@ function! s:SQLCErrorMsg(msg)
echohl None
endfunction
+function! sqlcomplete#PreCacheSyntax(...)
+ let syn_group_arr = []
+ if a:0 > 0
+ let syn_group_arr = a:1
+ else
+ let syn_group_arr = g:omni_sql_precache_syntax_groups
+ endif
+ if !empty(syn_group_arr)
+ for group_name in syn_group_arr
+ call s:SQLCGetSyntaxList(group_name)
+ endfor
+ endif
+endfunction
+
+function! sqlcomplete#Map(type)
+ " Tell the SQL plugin what you want to complete
+ let b:sql_compl_type=a:type
+ " Record previous omnifunc, if the SQL completion
+ " is being used in conjunction with other filetype
+ " completion plugins
+ if &omnifunc != "" && &omnifunc != 'sqlcomplete#Complete'
+ " Record the previous omnifunc, the plugin
+ " will automatically set this back so that it
+ " does not interfere with other ftplugins settings
+ let b:sql_compl_savefunc=&omnifunc
+ endif
+ " Set the OMNI func for the SQL completion plugin
+ let &omnifunc='sqlcomplete#Complete'
+endfunction
+
+function! s:SQLCGetSyntaxList(syn_group)
+ let syn_group = a:syn_group
+ let compl_list = []
+
+ " Check if we have already cached the syntax list
+ let list_idx = index(s:syn_list, syn_group, 0, &ignorecase)
+ if list_idx > -1
+ " Return previously cached value
+ let compl_list = s:syn_value[list_idx]
+ else
+ " Request the syntax list items from the
+ " syntax completion plugin
+ if syn_group == 'syntax'
+ " Handle this special case. This allows the user
+ " to indicate they want all the syntax items available,
+ " so do not specify a specific include list.
+ let g:omni_syntax_group_include_sql = ''
+ else
+ " The user has specified a specific syntax group
+ let g:omni_syntax_group_include_sql = syn_group
+ endif
+ let g:omni_syntax_group_exclude_sql = ''
+ let syn_value = OmniSyntaxList()
+ let g:omni_syntax_group_include_sql = s:save_inc
+ let g:omni_syntax_group_exclude_sql = s:save_exc
+ " Cache these values for later use
+ let s:syn_list = add( s:syn_list, syn_group )
+ let s:syn_value = add( s:syn_value, syn_value )
+ let compl_list = syn_value
+ endif
+
+ return compl_list
+endfunction
+
function! s:SQLCCheck4dbext()
if !exists('g:loaded_dbext')
let msg = "The dbext plugin must be loaded for dynamic SQL completion"
diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim
index 41a006e9f..2fc7ef627 100644
--- a/runtime/autoload/tar.vim
+++ b/runtime/autoload/tar.vim
@@ -1,6 +1,6 @@
" tar.vim: Handles browsing tarfiles
" AUTOLOAD PORTION
-" Date: Dec 24, 2005
+" Date: Mar 27, 2006
" Version: 7
" Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz>
" License: Vim License (see vim's :help license)
@@ -25,6 +25,7 @@ if exists("g:loaded_tar")
finish
endif
let g:loaded_tar= "v7"
+"call Decho("loading autoload/tar.vim")
" ---------------------------------------------------------------------
" Default Settings: {{{1
@@ -34,6 +35,9 @@ endif
if !exists("g:tar_readoptions")
let g:tar_readoptions= "OPxf"
endif
+if !exists("g:tar_cmd")
+ let g:tar_cmd= "tar"
+endif
if !exists("g:tar_writeoptions")
let g:tar_writeoptions= "uf"
endif
@@ -50,14 +54,15 @@ fun! tar#Browse(tarfile)
set report=10
" sanity checks
- if !executable("tar")
- echohl Error | echo '***error*** (tar#Browse) "tar" not available on your system'
+ if !executable(g:tar_cmd)
+ echohl Error | echo '***error*** (tar#Browse) "'.g:tar_cmd.'" not available on your system'
call inputsave()|call input("Press <cr> to continue")|call inputrestore()
let &report= repkeep
" call Dret("tar#Browse")
return
endif
if !filereadable(a:tarfile)
+" call Decho('a:tarfile<'.a:tarfile.'> not filereadable')
if a:tarfile !~# '^\a\+://'
" if its an url, don't complain, let url-handlers such as vim do its thing
echohl Error | echo "***error*** (tar#Browse) File not readable<".a:tarfile.">" | echohl None
@@ -80,20 +85,33 @@ fun! tar#Browse(tarfile)
set ft=tar
" give header
+" call Decho("printing header")
exe "$put ='".'\"'." tar.vim version ".g:loaded_tar."'"
exe "$put ='".'\"'." Browsing tarfile ".a:tarfile."'"
exe "$put ='".'\"'." Select a file with cursor and press ENTER"."'"
0d
$
- if a:tarfile =~# '\.\(gz\|tgz\)$'
- exe "silent r! gzip -d -c '".a:tarfile."'| tar -".g:tar_browseoptions." - "
- elseif a:tarfile =~# '\.bz2$'
- exe "silent r! bzip2 -d -c '".a:tarfile."'| tar -".g:tar_browseoptions." - "
+ let tarfile= a:tarfile
+ if has("win32") && executable("cygpath")
+ " assuming cygwin
+ let tarfile=substitute(system("cygpath -u ".tarfile),'\n$','','e')
+ endif
+ if tarfile =~# '\.\(gz\|tgz\)$'
+" call Decho("exe silent r! gzip -d -c '".tarfile."'| tar -".g:tar_browseoptions." - ")
+ exe "silent r! gzip -d -c '".tarfile."'| tar -".g:tar_browseoptions." - "
+ elseif tarfile =~# '\.bz2$'
+" call Decho("exe silent r! bzip2 -d -c '".tarfile."'| tar -".g:tar_browseoptions." - ")
+ exe "silent r! bzip2 -d -c '".tarfile."'| tar -".g:tar_browseoptions." - "
else
- exe "silent r! tar -".g:tar_browseoptions." '".a:tarfile."'"
+" call Decho("exe silent r! ".g:tar_cmd." -".g:tar_browseoptions." '".tarfile."'")
+ exe "silent r! ".g:tar_cmd." -".g:tar_browseoptions." '".tarfile."'"
+ endif
+ if v:shell_error != 0
+ echohl Error | echo '***error*** (tar#Browse) while browsing; check your g:tar_browseoptions<".g:tar_browseoptions.">"
+" call Dret("tar#Browse : w:tarfile<".w:tarfile.">")
+ return
endif
- silent %g@/$@d
setlocal noma nomod ro
noremap <silent> <buffer> <cr> :call <SID>TarBrowseSelect()<cr>
@@ -121,12 +139,21 @@ fun! s:TarBrowseSelect()
" about to make a new window, need to use w:tarfile
let tarfile= w:tarfile
let curfile= expand("%")
+ if has("win32") && executable("cygpath")
+ " assuming cygwin
+ let tarfile=substitute(system("cygpath -u ".tarfile),'\n$','','e')
+ endif
new
wincmd _
let s:tblfile_{winnr()}= curfile
-" call Decho("exe e tarfile:".tarfile.':'.fname)
- exe "e tarfile:".tarfile.':'.fname
+" if has("unix")
+"" call Decho("exe e tarfile:".tarfile.':'.fname)
+" exe "e tarfile:".tarfile.':'.fname
+" elseif has("win32")
+" call tar#Read("tarfile:".tarfile.':'.fname,1)
+" endif
+ call tar#Read("tarfile:".tarfile.':'.fname,1)
filetype detect
let &report= repkeep
@@ -141,7 +168,12 @@ fun! tar#Read(fname,mode)
set report=10
let tarfile = substitute(a:fname,'tarfile:\(.\{-}\):.*$','\1','')
let fname = substitute(a:fname,'tarfile:.\{-}:\(.*\)$','\1','')
-" call Decho("tarfile<".tarfile."> fname<".fname.">")
+ if has("win32") && executable("cygpath")
+ " assuming cygwin
+ let tarfile=substitute(system("cygpath -u ".tarfile),'\n$','','e')
+ endif
+" call Decho("tarfile<".tarfile.">")
+" call Decho("fname<".fname.">")
if tarfile =~# '\.\(gz\|tgz\)$'
" call Decho("exe silent r! gzip -d -c '".tarfile."'| tar -OPxf - '".fname."'")
@@ -151,7 +183,7 @@ fun! tar#Read(fname,mode)
exe "silent r! bzip2 -d -c '".tarfile."'| tar -".g:tar_readoptions." - '".fname."'"
else
" call Decho("exe silent r! tar -".g:tar_readoptions." '".tarfile."' '".fname."'")
- exe "silent r! tar -".g:tar_readoptions." '".tarfile."' '".fname."'"
+ exe "silent r! ".g:tar_cmd." -".g:tar_readoptions." '".tarfile."' '".fname."'"
endif
let w:tarfile= a:fname
exe "file tarfile:".fname
@@ -172,8 +204,8 @@ fun! tar#Write(fname)
set report=10
" sanity checks
- if !executable("tar")
- echohl Error | echo '***error*** (tar#Browse) "tar" not available on your system'
+ if !executable(g:tar_cmd)
+ echohl Error | echo '***error*** (tar#Browse) "'.g:tar_cmd.'" not available on your system'
call inputsave()|call input("Press <cr> to continue")|call inputrestore()
let &report= repkeep
" call Dret("tar#Write")
diff --git a/runtime/autoload/vimball.vim b/runtime/autoload/vimball.vim
index 6fa9a0da4..86f0e886d 100644
--- a/runtime/autoload/vimball.vim
+++ b/runtime/autoload/vimball.vim
@@ -1,7 +1,7 @@
" vimball : construct a file containing both paths and files
" Author: Charles E. Campbell, Jr.
-" Date: Mar 22, 2006
-" Version: 5
+" Date: Mar 31, 2006
+" Version: 6
" GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim
" Copyright: (c) 2004-2006 by Charles E. Campbell, Jr.
" The VIM LICENSE applies to Vimball.vim, and Vimball.txt
@@ -15,7 +15,7 @@ if &cp || exists("g:loaded_vimball")
finish
endif
let s:keepcpo = &cpo
-let g:loaded_vimball = "v5"
+let g:loaded_vimball = "v6"
set cpo&vim
" =====================================================================
@@ -190,7 +190,7 @@ fun! vimball#Vimball(really)
" call Decho("yanked ".fsize." lines into register-a")
" call Decho("didhelp<".didhelp."> fname<".fname.">")
- if didhelp == "" && fname =~ 'doc/[^/]\+\.txt$'
+ if a:really && didhelp == "" && fname =~ 'doc/[^/]\+\.txt$'
let didhelp= substitute(fname,'^\(.*\<doc\)[/\\][^.]*\.txt$','\1','e')
" call Decho("didhelp<".didhelp.">")
endif
diff --git a/runtime/autoload/xmlcomplete.vim b/runtime/autoload/xmlcomplete.vim
index 2551cae30..582dc1066 100644
--- a/runtime/autoload/xmlcomplete.vim
+++ b/runtime/autoload/xmlcomplete.vim
@@ -1,13 +1,13 @@
" Vim completion script
" Language: XML
" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
-" Last Change: 2006 Mar 19
+" Last Change: 2006 Mar 31
" This function will create Dictionary with users namespace strings and values
" canonical (system) names of data files. Names should be lowercase,
" descriptive to avoid any future conflicts. For example 'xhtml10s' should be
" name for data of XHTML 1.0 Strict and 'xhtml10t' for XHTML 1.0 Transitional
-" User interface will be provided by XMLns command defined ...
+" User interface will be provided by XMLns command defined in ftplugin/xml.vim
" Currently supported canonicals are:
" xhtml10s - XHTML 1.0 Strict
" xsl - XSL
@@ -224,8 +224,13 @@ function! xmlcomplete#CompleteTags(findstart, base)
let attrs = ['encoding', 'version="1.0"', 'version']
elseif tag =~ '^!'
" Don't make completion at all
+ "
return []
else
+ if !has_key(g:xmldata{'_'.g:xmldata_connection[b:xml_namespace]}, tag)
+ " Abandon when data file isn't complete
+ return []
+ endif
let attrs = keys(g:xmldata{'_'.g:xmldata_connection[b:xml_namespace]}[tag][1])
endif
@@ -324,6 +329,10 @@ function! xmlcomplete#CompleteTags(findstart, base)
let tags = keys(g:xmldata{'_'.g:xmldata_connection[b:xml_namespace]})
call filter(tags, 'v:val !~ "^vimxml"')
else
+ if !has_key(g:xmldata{'_'.g:xmldata_connection[b:xml_namespace]}, tag)
+ " Abandon when data file isn't complete
+ return []
+ endif
let tags = g:xmldata{'_'.g:xmldata_connection[b:xml_namespace]}[opentag][0]
endif
diff --git a/runtime/autoload/zip.vim b/runtime/autoload/zip.vim
index 99bdd7960..6790f4ff4 100644
--- a/runtime/autoload/zip.vim
+++ b/runtime/autoload/zip.vim
@@ -75,11 +75,15 @@ fun! zip#Browse(zipfile)
0d
$
-" call Decho("exe silent r! unzip -l '".escape(a:zipfile,s:zipfile_escape)."'")
- exe "silent r! unzip -l ".escape(a:zipfile,s:zipfile_escape)
+" call Decho("exe silent r! unzip -l '".a:zipfile."'")
+ exe "silent r! unzip -l '".a:zipfile."'"
+" call Decho("line 6: ".getline(6))
+ let namecol= stridx(getline(6),'Name') + 1
+" call Decho("namecol=".namecol)
+ 4,$g/^\s*----/d
+ 4,$g/^\s*\a/d
$d
- silent 4,$v/^\s\+\d\+\s\{0,5}\d/d
- silent 4,$s/^\%(.*\)\s\+\(\S\)/\1/
+ exe 'silent 4,$s/^.*\%'.namecol.'c//'
setlocal noma nomod ro
noremap <silent> <buffer> <cr> :call <SID>ZipBrowseSelect()<cr>
@@ -114,15 +118,15 @@ fun! s:ZipBrowseSelect()
" get zipfile to the new-window
let zipfile= substitute(w:zipfile,'.zip$','','e')
- let curfile= escape(expand("%"),s:zipfile_escape)
+ let curfile= expand("%")
" call Decho("zipfile<".zipfile.">")
" call Decho("curfile<".curfile.">")
new
wincmd _
let s:zipfile_{winnr()}= curfile
-" call Decho("exe e zipfile:".escape(zipfile,s:zipfile_escape).':'.fname)
- exe "e zipfile:".escape(zipfile,s:zipfile_escape).':'.fname
+" call Decho("exe e zipfile:".escape(zipfile,s:zipfile_escape).':'.escape(fname,s:zipfile_escape))
+ exe "e zipfile:".escape(zipfile,s:zipfile_escape).':'.escape(fname,s:zipfile_escape)
filetype detect
let &report= repkeep
@@ -140,8 +144,8 @@ fun! zip#Read(fname,mode)
let fname = substitute(a:fname,'zipfile:.\{-}:\([^\\].*\)$','\1','')
" call Decho("zipfile<".zipfile."> fname<".fname.">")
-" call Decho("exe r! unzip -p '".escape(zipfile,s:zipfile_escape)."' ".fname)
- exe "r! unzip -p ".escape(zipfile,s:zipfile_escape)." ".fname
+" call Decho("exe r! unzip -p '".zipfile."' '".fname."'")
+ exe "silent r! unzip -p '".zipfile."' '".fname."'"
" cleanup
0d
@@ -154,7 +158,7 @@ endfun
" ---------------------------------------------------------------------
" zip#Write: {{{2
fun! zip#Write(fname)
-" call Dfunc("zip#Write(fname<".a:fname.") zipfile_".winnr()."<".s:zipfile_{winnr()}.">")
+" call Dfunc("zip#Write(fname<".a:fname.">) zipfile_".winnr()."<".s:zipfile_{winnr()}.">")
let repkeep= &report
set report=10
@@ -211,6 +215,7 @@ fun! zip#Write(fname)
if executable("cygpath")
let dirpath = substitute(system("cygpath ".dirpath),'\n','','e')
endif
+" call Decho("mkdir(dirpath<".dirpath.">,p)")
call mkdir(dirpath,"p")
endif
if zipfile !~ '/'
@@ -218,13 +223,13 @@ fun! zip#Write(fname)
endif
" call Decho("zipfile<".zipfile."> fname<".fname.">")
- exe "w! ".fname
+ exe "w! ".escape(fname,s:zipfile_escape)
if executable("cygpath")
let zipfile = substitute(system("cygpath ".zipfile),'\n','','e')
endif
-" call Decho("zip -u ".zipfile.".zip ".fname)
- call system("zip -u ".zipfile.".zip ".fname)
+" call Decho("zip -u '".zipfile.".zip' '".fname."'")
+ call system("zip -u '".zipfile.".zip' '".fname."'")
if v:shell_error != 0
echohl Error | echo "***error*** (zip#Write) sorry, unable to update ".zipfile." with ".fname | echohl None
call inputsave()|call input("Press <cr> to continue")|call inputrestore()