summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/KVim.desktop44
-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
-rw-r--r--runtime/doc/autocmd.txt6
-rw-r--r--runtime/doc/diff.txt6
-rw-r--r--runtime/doc/editing.txt9
-rw-r--r--runtime/doc/eval.txt58
-rw-r--r--runtime/doc/gui.txt8
-rw-r--r--runtime/doc/hangulin.txt4
-rw-r--r--runtime/doc/help.txt10
-rw-r--r--runtime/doc/howto.txt4
-rw-r--r--runtime/doc/insert.txt42
-rw-r--r--runtime/doc/mbyte.txt4
-rw-r--r--runtime/doc/options.txt35
-rw-r--r--runtime/doc/os_dos.txt9
-rw-r--r--runtime/doc/os_win32.txt8
-rw-r--r--runtime/doc/pattern.txt9
-rw-r--r--runtime/doc/pi_paren.txt12
-rw-r--r--runtime/doc/pi_tar.txt27
-rw-r--r--runtime/doc/pi_zip.txt24
-rw-r--r--runtime/doc/spell.txt70
-rw-r--r--runtime/doc/sql.txt162
-rw-r--r--runtime/doc/starting.txt14
-rw-r--r--runtime/doc/syntax.txt21
-rw-r--r--runtime/doc/tabpage.txt12
-rw-r--r--runtime/doc/tags31
-rw-r--r--runtime/doc/todo.txt61
-rw-r--r--runtime/doc/usr_05.txt26
-rw-r--r--runtime/doc/usr_24.txt28
-rw-r--r--runtime/doc/usr_31.txt7
-rw-r--r--runtime/doc/usr_toc.txt4
-rw-r--r--runtime/doc/version7.txt138
-rw-r--r--runtime/doc/vimball.txt5
-rw-r--r--runtime/doc/windows.txt8
-rw-r--r--runtime/filetype.vim14
-rw-r--r--runtime/ftplugin/fortran.vim15
-rw-r--r--runtime/indent/fortran.vim12
-rw-r--r--runtime/indent/python.vim6
-rw-r--r--runtime/lang/menu_de_de.latin1.vim2
-rw-r--r--runtime/lang/menu_it_it.latin1.vim11
-rw-r--r--runtime/menu.vim24
-rw-r--r--runtime/mswin.vim4
-rw-r--r--runtime/plugin/matchparen.vim30
-rw-r--r--runtime/plugin/vimballPlugin.vim2
-rw-r--r--runtime/syntax/c.vim5
-rw-r--r--runtime/syntax/desc.vim12
-rw-r--r--runtime/syntax/fortran.vim187
-rw-r--r--runtime/syntax/rhelp.vim10
-rw-r--r--runtime/syntax/vim.vim6
-rw-r--r--runtime/tutor/tutor.pl129
-rw-r--r--runtime/tutor/tutor.pl.cp1250129
-rw-r--r--runtime/tutor/tutor.pl.utf-8129
58 files changed, 1727 insertions, 1046 deletions
diff --git a/runtime/KVim.desktop b/runtime/KVim.desktop
deleted file mode 100644
index 25ef20a56f..0000000000
--- a/runtime/KVim.desktop
+++ /dev/null
@@ -1,44 +0,0 @@
-# KDE Config File
-[Desktop Entry]
-Type=Application
-Exec=kvim -f %F
-Icon=kvim
-MiniIcon=kvim
-DocPath=kvim/index.html
-Comment=
-Comment[xx]=xx
-Terminal=0
-Name=KVim
-Name[eo]=VIM-fasado
-Name[sv]=Kvim
-Name[xx]=xx
-Comment=Text Editor
-Comment[ar]=محرر نصوص
-Comment[bg]=Текст Редактор
-Comment[de]=Texteditor
-Comment[el]=Διορθωτής Κειμένου
-Comment[eo]=Tekstredaktilo
-Comment[et]=Tekstiredaktor
-Comment[eu]=Testu Editorea
-Comment[fi]=Tekstieditori
-Comment[he]=עורך טקסט
-Comment[is]=Textaritill
-Comment[ja]=テキストエディタ
-Comment[lt]=Teksto redaktorius
-Comment[mt]=Editur tat-test
-Comment[pt_BR]=Editor de Texto
-Comment[ro]=Editor de text
-Comment[ru]=редактор
-Comment[sk]=Textový editor
-Comment[sl]=Urejevalnik besedil
-Comment[ta]=¯¨Ã ¦¾¡ÌôÀ¡Ç÷
-Comment[tr]=Metin Düzenleyici
-Comment[uk]=Редактор текстів
-Comment[vi]=Trình soạn văn bản
-Comment[xx]=xx
-Comment[zh_CN]=文本编辑器
-Comment[zh_TW]=文字編輯器
-MimeType=application/mathml+xml;application/xhtml+xml;application/x-perl;application/x-python;application/x-shellscript;audio/x-mpegurl;audio/x-scpls;image/svg+xml;message/news;message/rfc822;text/calendar;text/css;text/english;text/html;text/mrml;text/plain;text/rdf;text/rss;text/rtf;text/sgml;text/vnd.wap.wml;text/x-adasrc;text/x-bibtex;text/x-chdr;text/x-c++hdr;text/x-csrc;text/x-c++src;text/x-csv;text/x-diff;text/x-java;text/x-katefilelist;text/x-latex;text/x-log;text/x-lyx;text/x-makefile;text/xmcd;text/xml;text/x-moc;text/x-mswinurl;text/x-objcsrc;text/x-pascal;text/x-perl;text/x-python;text/x-tcl;text/x-tex;text/x-vcalendar;text/x-vcard;text/x-xslfo;text/x-xslt
-X-KDE-StartupNotify=true
-X-KDE-AuthorizeAction=shell access
-
diff --git a/runtime/autoload/gzip.vim b/runtime/autoload/gzip.vim
index a6467b8f6d..f6f7bc41d4 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 399f671e0d..00a3f3e873 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 4d448dc2bc..8cb4db0366 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