diff options
author | Justin Gassner <justin.gassner@web.de> | 2015-06-28 13:28:20 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2015-08-02 05:17:49 -0400 |
commit | 63d5b8707b3b35b91b4dd23d578e5b0adfb2a9b2 (patch) | |
tree | 81227434ad8e03086b11fd2431e6319d0bcaa667 | |
parent | efa059c5a4611629890e28987a83aa781952b78c (diff) | |
download | rneovim-63d5b8707b3b35b91b4dd23d578e5b0adfb2a9b2.tar.gz rneovim-63d5b8707b3b35b91b4dd23d578e5b0adfb2a9b2.tar.bz2 rneovim-63d5b8707b3b35b91b4dd23d578e5b0adfb2a9b2.zip |
vim-patch:5d89d9b #2922
Update runtime files.
https://code.google.com/p/vim/source/detail?r=5d89d9b40499059e1a64dc35fbae94313fba0098
-rw-r--r-- | runtime/autoload/phpcomplete.vim | 74 | ||||
-rw-r--r-- | runtime/doc/editing.txt | 26 | ||||
-rw-r--r-- | runtime/doc/eval.txt | 15 | ||||
-rw-r--r-- | runtime/doc/indent.txt | 2 | ||||
-rw-r--r-- | runtime/doc/syntax.txt | 3 | ||||
-rw-r--r-- | runtime/doc/todo.txt | 97 | ||||
-rw-r--r-- | runtime/doc/windows.txt | 10 | ||||
-rw-r--r-- | runtime/filetype.vim | 6 | ||||
-rw-r--r-- | runtime/indent/php.vim | 87 | ||||
-rw-r--r-- | runtime/macros/editexisting.vim | 4 | ||||
-rw-r--r-- | runtime/syntax/zimbu.vim | 64 |
11 files changed, 274 insertions, 114 deletions
diff --git a/runtime/autoload/phpcomplete.vim b/runtime/autoload/phpcomplete.vim index b014b4cdcf..5ddad88873 100644 --- a/runtime/autoload/phpcomplete.vim +++ b/runtime/autoload/phpcomplete.vim @@ -3,7 +3,7 @@ " Maintainer: Dávid Szabó ( complex857 AT gmail DOT com ) " Previous Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) " URL: https://github.com/shawncplus/phpcomplete.vim -" Last Change: 2014 Oct 02 +" Last Change: 2014 Dec 01 " " OPTIONS: " @@ -1172,11 +1172,11 @@ function! phpcomplete#GetCurrentInstruction(line_number, col_number, phpbegin) " " break if we are on a "naked" stop_char (operators, colon, openparent...) if index(stop_chars, current_char) != -1 let do_break = 1 - " dont break does not look like a "->" + " dont break if it does look like a "->" if (prev_char == '-' && current_char == '>') || (current_char == '-' && next_char == '>') let do_break = 0 endif - " dont break if its looks like a "::" + " dont break if it does look like a "::" if (prev_char == ':' && current_char == ':') || (current_char == ':' && next_char == ':') let do_break = 0 endif @@ -1356,8 +1356,12 @@ function! phpcomplete#GetCallChainReturnType(classname_candidate, class_candidat endif " make @return self, static, $this the same way " (not exactly what php means by these) - if returnclass == 'self' || returnclass == 'static' || returnclass == '$this' - let classname_candidate = a:classname_candidate + if returnclass == 'self' || returnclass == 'static' || returnclass == '$this' || returnclass == 'self[]' || returnclass == 'static[]' || returnclass == '$this[]' + if returnclass =~ '\[\]$' + let classname_candidate = a:classname_candidate.'[]' + else + let classname_candidate = a:classname_candidate + endif let class_candidate_namespace = a:class_candidate_namespace else let [classname_candidate, class_candidate_namespace] = phpcomplete#ExpandClassName(returnclass, fullnamespace, a:imports) @@ -1527,7 +1531,7 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor let function_boundary = phpcomplete#GetCurrentFunctionBoundaries() let search_end_line = max([1, function_boundary[0][0]]) " -1 makes us ignore the current line (where the completion was invoked - let lines = reverse(getline(search_end_line, line('.') - 1)) + let lines = reverse(getline(search_end_line, a:start_line - 1)) " check Constant lookup let constant_object = matchstr(a:context, '\zs'.class_name_pattern.'\ze::') @@ -1638,9 +1642,32 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor " assignment for the variable in question with a variable on the right hand side if line =~# '^\s*'.object.'\s*=&\?\s*'.variable_name_pattern - let tailing_semicolon = match(line, ';\s*$') - let tailing_semicolon = tailing_semicolon != -1 ? tailing_semicolon : strlen(getline(a:start_line - i)) - let prev_context = phpcomplete#GetCurrentInstruction(a:start_line - i, tailing_semicolon - 1, b:phpbegin) + + " try to find the next non-comment or string ";" char + let start_col = match(line, '^\s*'.object.'\C\s*=\zs&\?\s*'.variable_name_pattern) + let filelines = reverse(lines) + let [pos, char] = s:getNextCharWithPos(filelines, [a:start_line - i - 1, start_col]) + let chars_read = 1 + " read while end of the file + while char != 'EOF' && chars_read < 1000 + let last_pos = pos + let [pos, char] = s:getNextCharWithPos(filelines, pos) + let chars_read += 1 + " we got a candidate + if char == ';' + let synIDName = synIDattr(synID(pos[0] + 1, pos[1] + 1, 0), 'name') + " it's not a comment or string, end search + if synIDName !~? 'comment\|string' + break + endif + endif + endwhile + + let prev_context = phpcomplete#GetCurrentInstruction(last_pos[0] + 1, last_pos[1], b:phpbegin) + if prev_context == '' + " cannot get previous context give up + return + endif let prev_class = phpcomplete#GetClassName(a:start_line - i, prev_context, a:current_namespace, a:imports) if stridx(prev_class, '\') != -1 @@ -1656,9 +1683,32 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor " assignment for the variable in question with a function on the right hand side if line =~# '^\s*'.object.'\s*=&\?\s*'.function_invocation_pattern - let tailing_semicolon = match(line, ';\s*$') - let tailing_semicolon = tailing_semicolon != -1 ? tailing_semicolon : strlen(getline(a:start_line - i)) - let prev_context = phpcomplete#GetCurrentInstruction(a:start_line - i, tailing_semicolon - 1, b:phpbegin) + + " try to find the next non-comment or string ";" char + let start_col = match(line, '\C^\s*'.object.'\s*=\zs&\?\s*'.function_invocation_pattern) + let filelines = reverse(lines) + let [pos, char] = s:getNextCharWithPos(filelines, [a:start_line - i - 1, start_col]) + let chars_read = 1 + " read while end of the file + while char != 'EOF' && chars_read < 1000 + let last_pos = pos + let [pos, char] = s:getNextCharWithPos(filelines, pos) + let chars_read += 1 + " we got a candidate + if char == ';' + let synIDName = synIDattr(synID(pos[0] + 1, pos[1] + 1, 0), 'name') + " it's not a comment or string, end search + if synIDName !~? 'comment\|string' + break + endif + endif + endwhile + + let prev_context = phpcomplete#GetCurrentInstruction(last_pos[0] + 1, last_pos[1], b:phpbegin) + if prev_context == '' + " cannot get previous context give up + return + endif let function_name = matchstr(prev_context, '^'.function_invocation_pattern.'\ze') let function_name = matchstr(function_name, '^\zs.\+\ze\s*($') " strip the trailing ( diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index 63c27b2ff2..bb3d89e4ac 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -569,7 +569,10 @@ list of the current window. Also see |++opt| and |+cmd|. :[count]arga[dd] {name} .. *:arga* *:argadd* *E479* - Add the {name}s to the argument list. +:[count]arga[dd] + Add the {name}s to the argument list. When {name} is + omitted add the current buffer name to the argument + list. If [count] is omitted, the {name}s are added just after the current entry in the argument list. Otherwise they are added after the [count]'th file. @@ -579,7 +582,8 @@ list of the current window. :argadd x a b x c :0argadd x x a b c :1argadd x a x b c - :99argadd x a b c x + :$argadd x a b c x + :+2argadd y a b c x y There is no check for duplicates, it is possible to add a file to the argument list twice. The currently edited file is not changed. @@ -597,11 +601,19 @@ list of the current window. Example: > :argdel *.obj -:{range}argd[elete] Delete the {range} files from the argument list. +:[range]argd[elete] Delete the {range} files from the argument list. + Example: > + :10,$argdel +< Deletes arguments 10 and further, keeping 1-9. > + :$argd +< Deletes just the last one. > + :argd + :.argd +< Deletes the current argument. > + :%argd +< Removes all the files from the arglist. When the last number in the range is too high, up to - the last argument is deleted. Example: > - :10,1000argdel -< Deletes arguments 10 and further, keeping 1-9. + the last argument is deleted. *:argu* *:argument* :[count]argu[ment] [count] [++opt] [+cmd] @@ -1018,7 +1030,7 @@ The names can be in upper- or lowercase. :q[uit]! Quit without writing, also when currently visible buffers have changes. Does not exit when this is the - last window and there are is a changed hidden buffer. + last window and there is a changed hidden buffer. In this case, the first changed hidden buffer becomes the current buffer. Use ":qall!" to exit always. diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 61b23b7e03..9182eb76b5 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.4. Last change: 2014 Nov 15 +*eval.txt* For Vim version 7.4. Last change: 2014 Nov 27 VIM REFERENCE MANUAL by Bram Moolenaar @@ -3303,6 +3303,17 @@ getchar([expr]) *getchar()* : endif : endwhile :endfunction +< + You may also receive syntetic characters, such as + |<CursorHold>|. Often you will want to ignore this and get + another character: > + :function GetKey() + : let c = getchar() + : while c == "\<CursorHold>" + : let c = getchar() + : endwhile + : return c + :endfunction getcharmod() *getcharmod()* The result is a Number which is the state of the modifiers for @@ -3513,7 +3524,7 @@ getpos({expr}) Get the position for {expr}. For possible values of {expr} This can be used to save and restore the position of a mark: > let save_a_mark = getpos("'a") ... - call setpos(''a', save_a_mark + call setpos("'a", save_a_mark) < Also see |getcurpos()| and |setpos()|. diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt index fc16b1a7e7..3f61e28651 100644 --- a/runtime/doc/indent.txt +++ b/runtime/doc/indent.txt @@ -1,4 +1,4 @@ -*indent.txt* For Vim version 7.4. Last change: 2014 Apr 23 +*indent.txt* For Vim version 7.4. Last change: 2014 Dec 06 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 6bc1b2873c..88f23e6c76 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 7.4. Last change: 2014 Sep 27 +*syntax.txt* For Vim version 7.4. Last change: 2014 Nov 19 VIM REFERENCE MANUAL by Bram Moolenaar @@ -5055,6 +5055,7 @@ This will set the "w:current_syntax" variable to "foo". The value of restoring "b:current_syntax", since the syntax files do set "b:current_syntax". The value set by the syntax file is assigned to "w:current_syntax". +Note: This resets the 'spell', 'spellcapcheck' and 'spellfile' options. Once a window has its own syntax, syntax commands executed from other windows on the same buffer (including :syntax clear) have no effect. Conversely, diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 88c277ef43..78ae536c5a 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.4. Last change: 2014 Nov 19 +*todo.txt* For Vim version 7.4. Last change: 2014 Dec 06 VIM REFERENCE MANUAL by Bram Moolenaar @@ -34,9 +34,23 @@ not be repeated below, unless there is extra information. *known-bugs* -------------------- Known bugs and current work ----------------------- +Patch to fix list range assign crash. (Yukihiro Nakadaira, 2014 Dec 1) + +Patch to fix range with user command. (Marcin Szamotulski, 2014 Dec 2) +Update Dec 6, with support for user commands. + +When window number in Ex range is too high, give an error? +Only when backwards compatible. + +:s/\n// doesn't change anything. Since 7.4.232? (Eliseo Martínez, 2014 Nov +28) Patch on Issue 287 + +Using vim_snprintf() in window.c can be in a function. + Regexp problems: - The NFA engine does not implement the time limit passed to nfa_regexec_multi() +- Very slow with a long line and Ruby highlighting. (John Whitley, 2014 Dec 4) - Bug with pattern: '\vblock (\d+)\.\n.*\d+%(\1)@<!\.$' (Lech Lorens, 2014 Feb 3) - Issue 164: freeze on regexp search. @@ -64,17 +78,11 @@ Breaks test_eval. Inefficient, can we only compute y_width when needed? Problem that a previous silent ":throw" causes a following try/catch not to work. (ZyX, 2013 Sep 28) +Patch to fix recognizing function name. (Ozaki Kiichi, 2014 Nov 28) + ":cd C:\Windows\System32\drivers\etc*" does not work, even though the directory exists. (Sergio Gallelli, 2013 Dec 29) -Patch by Marcin Szamotulski to add count to :close (2014 Aug 10, update Aug -14, Aug 30) - Make ":1close" close the first window. - Make ":+1close" close the next window. - Make ":-1close" close the previous window. -Doesn't look right, asked for updates. -Update 2014 Nov 8. Replied with suggestions. - The entries added by matchaddpos() are returned by getmatches() but can't be set with setmatches(). (lcd47, 2014 Jun 29) @@ -84,34 +92,34 @@ Problem using ":try" inside ":execute". (ZyX, 2013 Sep 15) Python: ":py raw_input('prompt')" doesn't work. (Manu Hack) -Patch to fix issue 78. (Christian Brabandt, 2014 Oct 8) - -Patch to fix leak in map() with error. (Christian Brabandt, 2014 Oct 11) - -Patch to fix incsearch for "2/pattern/e". - -Patch to fix memory leak in :hardcopy. (Christian Brabandt, 2014 Nov 16) - -Patch to fix warnings in if_ruby.c. (Ken Takata, 2014 Nov 17) - -Patch to make test 63 pass when in a B&W terminal. (Christian Brabandt, 2014 -Nov 15) Other patch (better) on Nov 17. - Change behavior of v:hlsearch? Patch from Christian, 2014 Oct 22. +Patch to recover from X server restart: hint on Issue 203 (2014 Nov 21 18:44) + MS-Windows: When editing a file with a leading space, writing it uses the wrong name. (Aram, 2014 Nov 7) Vim 7.4. +Add LessCss support. (Jenoma / Alessandro Vioni, 2014 Nov 24) +Now with updated license, Nov 24. + patch to remove FEAT_OSFILETYPE from fileio.c. (Christian, 2014 Nov 12) Value returned by virtcol() changes depending on how lines wrap. This is inconsistent with the documentation. -Patch to fix relatie numbers. (Christian Brabandt, 2014 Nov 17) +Ukrainian vimtutor. (Issue 288) + +Regenerate the Unicode tables in mbyte.c. +Diff from ZyX, 2014 Dec 6. + +Patch to fix relative numbers. (Christian Brabandt, 2014 Nov 17) +Update Nov 26. Patch to fix wrong formatting if 'linebreak' is set. (Christian Brabandt, 2014 Nov 12) +Patch to avoid recognizing polkit as hog files. (Issue 292) + Patch to support hex values for setting option value. (Zyx, 2015 Nov 6) @@ -122,17 +130,29 @@ Update Nov 5. MS-Windows: Crash opening very long file name starting with "\\". (Christian Brock, 2012 Jun 29) +Cursorline background color not mixed with character highlight. +Patch by Yasuhiro Matsumoto, 2014 Dec 3. + Problem using diff syntax with cp932 encoding. Idea from Yasuhiro Matsumoto, patch from Ken Takata (2014 Nov 6) ml_updatechunk() is slow when retrying for another encoding. (John Little, 2014 Sep 11) +Patch to add a different escape sequence for replace mode. +(Omar Sandoval, 2014 Nov 30) + +Patch to allow values greater than 255 for ctermfg/ctermbg on Windows. +(Yasuhiro Matsumoto, 2014 Dec 5) + When 'balloonexpr' returns a list the result has a trailing newline. Just remove one trailing newline. (lcd, 2014 Oct 17) Make comments in the test Makefile silent. (Kartik Agaram, 2014 Sep 24) +Result of systemlist() does not show whether text ended in line break. +(Bjorn Linse, 2014 Nov 27) + When in 'comments' "n:x" follows after three-part comment directly it repeats any one-character from the previous line. (Kartik Agaram, 2014 Sep 19) @@ -147,6 +167,15 @@ Plugins need to make a lot of effort, lots of mappings, to know what happened before pressing the key that triggers a plugin action. How about keeping the last N pressed keys, so that they do not need to be mapped? +":q!" should reset modified flag for current buffer, if another buffer is +modified no need to abandon it again. +Patch from Yasuhiro Matsumoto, 2014 Nov 21. +Update from Hirohito Higashi, 2014 Nov 21. +With test, Nov 23. + +Wrong scrolling when using incsearch. Patch by Christian Brabandt, 2014 Dec 4. +Is this a good solution? + Can assign to s:type when a function s:type has been defined. Also the other way around: define a function while a variable with that name was already defined. @@ -175,6 +204,7 @@ Bug: Autocompleting ":tag/pat" replaces "/pat" with a match but does not insert a space. (Micha Mos, 2014 Nov 7) Patch to add the :bvimgrep command. (Christian Brabandt, 2014 Nov 12) +Update Dec 6. Patch to add argument to :cquit. (Thinca, 2014 Oct 12) @@ -287,6 +317,10 @@ Yasuhiro Matsumoto, 2013 May 31. Or should we add a more general mechanism, like a lambda() function? Patch by Yasuhiro Matsumoto, 2014 Sep 16. +Patch to fix display of listchars on the cursorline. (Nayuri Aohime, 2013) +Update suggested by Yasuhiro Matsumoto, 2014 Nov 25: +https://gist.github.com/presuku/d3d6b230b9b6dcfc0477 + Patch for XDG base directory support. (Jean François Bignolles, 2014 Mar 4) Remark on the docs. Should not be a compile time feature. But then what? @@ -537,6 +571,14 @@ MS-Windows resizing problems: causes the window to move unnecessarily. (William E. Skeith III, 2012 Jan 12) Patch: 2012 Jan 13 Needs more work (2012 Feb 2) +Patch to use Modern UI 2.0 for the Nsis installer. (Guopeng Wen, 2010 Jul 30) +Latest version: 2011 May 18 +8 Windows install with NSIS: make it possible to do a silent install, see + http://nsis.sourceforge.net/Docs/Chapter4.html#4.12 + Version from Guopeng Wen that does this (2010 Dec 27) +Alternative: MSI installer: https://github.com/petrkle/vim-msi/ +Or the one on Issue 279 + 'iminsert' global value set when using ":setlocal iminsert"? (Wu, 2012 Jun 23) Patch to append regexp to tag commands to make it possible to select one out @@ -847,7 +889,7 @@ Assume the system converts between the actual encoding of the filesystem to the system encoding (usually utf-8). Patch to add GUI colors to the terminal, when it supports it. (ZyX, 2013 Jan -26, update 2013 Dec 14) +26, update 2013 Dec 14, another 2014 Nov 22) Problem producing tags file when hebrew.frx is present. It has a BOM. Results in E670. (Tony Mechelynck, 2010 May 2) @@ -1479,13 +1521,6 @@ with "gvim -nb:localhost:55555:foo". From nc do: '1:editFile!0 "foo"'. Then go to Insert mode and add a few lines. Then backspacing every other time moves the cursor instead of deleting. (Chris Kaiser, 2007 Sep 25) -Patch to use Modern UI 2.0 for the Nsis installer. (Guopeng Wen, 2010 Jul 30) -Latest version: 2011 May 18 -8 Windows install with NSIS: make it possible to do a silent install, see - http://nsis.sourceforge.net/Docs/Chapter4.html#4.12 - Version from Guopeng Wen that does this (2010 Dec 27) -Alternative: MSI installer: https://github.com/petrkle/vim-msi/ - Windows installer should install 32-bit version of right-click handler also on 64-bit systems. (Brian Cunningham, 2011 Dec 28) diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index ba69b7cf2f..39d3c43d97 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -1,4 +1,4 @@ -*windows.txt* For Vim version 7.4. Last change: 2014 Sep 23 +*windows.txt* For Vim version 7.4. Last change: 2014 Dec 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -280,7 +280,7 @@ CTRL-W CTRL-Q *CTRL-W_CTRL-Q* " if there are less than 9 windows opened :-quit " quit the previous window :+quit " quit the next window - :+2quit " will also work as expected + :+2quit " quit the second next window < :q[uit]! :{count}q[uit]! @@ -324,9 +324,9 @@ CTRL-W CTRL-C *CTRL-W_CTRL-C* screen. For {count} see |:quit|. The buffer becomes hidden (unless there is another window - editing it or 'bufhidden' is `unload` or `delete`). If the - window is the last one in the current tab page the tab page is - closed. |tab-page| + editing it or 'bufhidden' is `unload`, `delete` or `wipe`). + If the window is the last one in the current tab page the tab + page is closed. |tab-page| The value of 'hidden' is irrelevant for this command. Changes to the buffer are not written and won't get lost, so diff --git a/runtime/filetype.vim b/runtime/filetype.vim index d7bac1bdcf..71d6b0b25a 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2014 Nov 05 +" Last Change: 2014 Dec 06 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -1852,7 +1852,7 @@ au BufNewFile,BufRead sgml.catalog* call s:StarSetf('catalog') " Shell scripts (sh, ksh, bash, bash2, csh); Allow .profile_foo etc. " Gentoo ebuilds and Arch Linux PKGBUILDs are actually bash scripts -au BufNewFile,BufRead .bashrc*,bashrc,bash.bashrc,.bash_profile*,.bash_logout*,*.bash,*.ebuild,PKGBUILD* call SetFileTypeSH("bash") +au BufNewFile,BufRead .bashrc*,bashrc,bash.bashrc,.bash_profile*,.bash_logout*,.bash_aliases*,*.bash,*.ebuild,PKGBUILD* call SetFileTypeSH("bash") au BufNewFile,BufRead .kshrc*,*.ksh call SetFileTypeSH("ksh") au BufNewFile,BufRead */etc/profile,.profile*,*.sh,*.env call SetFileTypeSH(getline(1)) @@ -2506,6 +2506,8 @@ au BufNewFile,BufRead */etc/yum.conf setf dosini " Zimbu au BufNewFile,BufRead *.zu setf zimbu +" Zimbu Templates +au BufNewFile,BufRead *.zut setf zimbutempl " Zope " dtml (zope dynamic template markup language), pt (zope page template), diff --git a/runtime/indent/php.vim b/runtime/indent/php.vim index b83a1923ed..1bffa7f195 100644 --- a/runtime/indent/php.vim +++ b/runtime/indent/php.vim @@ -3,8 +3,8 @@ " Author: John Wellesz <John.wellesz (AT) teaser (DOT) fr> " URL: http://www.2072productions.com/vim/indent/php.vim " Home: https://github.com/2072/PHP-Indenting-for-VIm -" Last Change: 2014 April 3rd -" Version: 1.49 +" Last Change: 2014 November 26th +" Version: 1.57 " " " Type :help php-indent for available options @@ -48,7 +48,7 @@ endif let b:did_indent = 1 -let php_sync_method = 0 +let g:php_sync_method = 0 @@ -112,7 +112,7 @@ setlocal nocindent setlocal nolisp setlocal indentexpr=GetPhpIndent() -setlocal indentkeys=0{,0},0),:,!^F,o,O,e,*<Return>,=?>,=<?,=*/ +setlocal indentkeys=0{,0},0),0],:,!^F,o,O,e,*<Return>,=?>,=<?,=*/ @@ -128,11 +128,14 @@ if exists("*GetPhpIndent") endif +let s:PHP_validVariable = '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*' let s:notPhpHereDoc = '\%(break\|return\|continue\|exit\|die\|else\)' let s:blockstart = '\%(\%(\%(}\s*\)\=else\%(\s\+\)\=\)\=if\>\|\%(}\s*\)\?else\>\|do\>\|while\>\|switch\>\|case\>\|default\>\|for\%(each\)\=\>\|declare\>\|class\>\|trait\>\|use\>\|interface\>\|abstract\>\|final\>\|try\>\|\%(}\s*\)\=catch\>\|\%(}\s*\)\=finally\>\)' -let s:functionDecl = '\<function\>\%(\s\+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\)\=\s*(.*' +let s:functionDecl = '\<function\>\%(\s\+'.s:PHP_validVariable.'\)\=\s*(.*' let s:endline= '\s*\%(//.*\|#.*\|/\*.*\*/\s*\)\=$' -let s:terminated = '\%(\%(;\%(\s*\%(?>\|}\)\)\=\|<<<''\=\a\w*''\=$\|^\s*}\)'.s:endline.'\)\|^[^''"`]*[''"`]$' + + +let s:terminated = '\%(\%(;\%(\s*\%(?>\|}\)\)\=\|<<<''\=\a\w*''\=$\|^\s*}\|^\s*'.s:PHP_validVariable.':\)'.s:endline.'\)\|^[^''"`]*[''"`]$' let s:PHP_startindenttag = '<?\%(.*?>\)\@!\|<script[^>]*>\%(.*<\/script>\)\@!' @@ -140,7 +143,7 @@ let s:PHP_startindenttag = '<?\%(.*?>\)\@!\|<script[^>]*>\%(.*<\/script>\)\@!' let s:escapeDebugStops = 0 function! DebugPrintReturn(scriptLine) - if ! s:escapeDebugStops + if ! s:escapeDebugStops echo "debug:" . a:scriptLine let c = getchar() if c == "\<Del>" @@ -158,8 +161,6 @@ function! GetLastRealCodeLNum(startline) " {{{ let lnum = b:GetLastRealCodeLNum_ADD endif - let old_lnum = lnum - while lnum > 1 let lnum = prevnonblank(lnum) let lastline = getline(lnum) @@ -217,7 +218,7 @@ function! GetLastRealCodeLNum(startline) " {{{ let lnum=0 endif - if b:InPHPcode_and_script && !b:InPHPcode + if b:InPHPcode_and_script && 1 > b:InPHPcode let b:InPHPcode_and_script = 0 endif @@ -237,7 +238,7 @@ endfun function! Skippmatch() " {{{ let synname = synIDattr(synID(line("."), col("."), 0), "name") - if synname == "Delimiter" || synname == "phpRegionDelimiter" || synname =~# "^phpParent" || synname == "phpArrayParens" || synname =~# '^php\%(Block\|Brace\)' || synname == "javaScriptBraces" || synname =~# "^phpComment" && b:UserIsTypingComment + if synname == "Delimiter" || synname == "phpRegionDelimiter" || synname =~# "^phpParent" || synname == "phpArrayParens" || synname =~# '^php\%(Block\|Brace\)' || synname == "javaScriptBraces" || synname =~# '^php\%(Doc\)\?Comment' && b:UserIsTypingComment return 0 else return 1 @@ -249,7 +250,7 @@ function! FindOpenBracket(lnum, blockStarter) " {{{ let line = searchpair('{', '', '}', 'bW', 'Skippmatch()') if a:blockStarter == 1 - while line > 1 + while line > 1 let linec = getline(line) if linec =~ s:terminated || linec =~ '^\s*\%(' . s:blockstart . '\)\|'. s:functionDecl . s:endline @@ -310,7 +311,6 @@ let s:defaultORcase = '^\s*\%(default\|case\).*:' function! FindTheSwitchIndent (lnum) " {{{ - let test = GetLastRealCodeLNum(a:lnum - 1) if test <= 1 @@ -353,7 +353,7 @@ function! IslinePHP (lnum, tofind) " {{{ if synname == 'phpStringSingle' || synname == 'phpStringDouble' || synname == 'phpBacktick' if cline !~ '^\s*[''"`]' - return "" + return "SpecStringEntrails" else return synname end @@ -372,7 +372,7 @@ if ! s:autoresetoptions endif function! ResetPhpOptions() - if ! b:optionsset && &filetype == "php" + if ! b:optionsset && &filetype =~ "php" if b:PHP_autoformatcomment setlocal comments=s1:/*,mb:*,ex:*/,://,:# @@ -418,7 +418,7 @@ function! GetPhpIndent() let b:PHP_indentinghuge = 0 let b:PHP_CurrentIndentLevel = b:PHP_default_indenting endif - let b:PHP_lastindented = v:lnum + let real_PHP_lastindented = v:lnum let b:PHP_LastIndentedWasComment=0 let b:PHP_InsideMultilineComment=0 let b:PHP_indentbeforelast = 0 @@ -430,9 +430,12 @@ function! GetPhpIndent() elseif v:lnum > b:PHP_lastindented let real_PHP_lastindented = b:PHP_lastindented - let b:PHP_lastindented = v:lnum + else + let real_PHP_lastindented = v:lnum endif + let b:PHP_lastindented = v:lnum + if !b:InPHPcode_checked " {{{ One time check let b:InPHPcode_checked = 1 @@ -443,11 +446,15 @@ function! GetPhpIndent() endif if synname!="" - if synname != "phpHereDoc" && synname != "phpHereDocDelimiter" + if synname == "SpecStringEntrails" + let b:InPHPcode = -1 " thumb down + let b:UserIsTypingComment = 0 + let b:InPHPcode_tofind = "" + elseif synname != "phpHereDoc" && synname != "phpHereDocDelimiter" let b:InPHPcode = 1 let b:InPHPcode_tofind = "" - if synname =~# "^phpComment" + if synname =~# '^php\%(Doc\)\?Comment' let b:UserIsTypingComment = 1 else let b:UserIsTypingComment = 0 @@ -483,9 +490,16 @@ function! GetPhpIndent() if b:InPHPcode_tofind!="" if cline =~? b:InPHPcode_tofind - let b:InPHPcode = 1 let b:InPHPcode_tofind = "" let b:UserIsTypingComment = 0 + + if b:InPHPcode == -1 + let b:InPHPcode = 1 + return -1 + end + + let b:InPHPcode = 1 + if cline =~ '\*/' call cursor(v:lnum, 1) if cline !~ '^\*/' @@ -510,7 +524,7 @@ function! GetPhpIndent() endif endif - if b:InPHPcode + if 1 == b:InPHPcode if !b:InPHPcode_and_script && last_line =~ '\%(<?.*\)\@<!?>\%(.*<?\)\@!' && IslinePHP(lnum, '?>')=~"Delimiter" if cline !~? s:PHP_startindenttag @@ -520,8 +534,8 @@ function! GetPhpIndent() let b:InPHPcode_and_script = 1 endif - elseif last_line =~ '^[^''"`]\+[''"`]$' " a string identifier with nothing after it and no other string identifier before - let b:InPHPcode = 0 + elseif last_line =~ '^[^''"`]\+[''"`]$' + let b:InPHPcode = -1 let b:InPHPcode_tofind = substitute( last_line, '^.*\([''"`]\).*$', '^[^\1]*\1[;,]$', '') elseif last_line =~? '<<<''\=\a\w*''\=$' let b:InPHPcode = 0 @@ -538,7 +552,7 @@ function! GetPhpIndent() endif " }}} - if !b:InPHPcode && !b:InPHPcode_and_script + if 1 > b:InPHPcode && !b:InPHPcode_and_script return -1 endif @@ -568,7 +582,7 @@ function! GetPhpIndent() endif endif - if !b:PHP_InsideMultilineComment && cline =~ '^\s*/\*' && cline !~ '\*/\s*$' + if !b:PHP_InsideMultilineComment && cline =~ '^\s*/\*\%(.*\*/\)\@!' if getline(v:lnum + 1) !~ '^\s*\*' return -1 endif @@ -669,17 +683,17 @@ function! GetPhpIndent() endwhile elseif last_line =~# unstated && cline !~ '^\s*);\='.endline - let ind = ind + &sw " we indent one level further when the preceding line is not stated + let ind = ind + &sw return ind + addSpecial - elseif (ind != b:PHP_default_indenting || last_line =~ '^[)\]]' ) && last_line =~ terminated " Added || last_line =~ '^)' on 2007-12-30 (array indenting problem broke other things) + elseif (ind != b:PHP_default_indenting || last_line =~ '^[)\]]' ) && last_line =~ terminated let previous_line = last_line let last_line_num = lnum let LastLineClosed = 1 let isSingleLineBlock = 0 while 1 - if ! isSingleLineBlock && previous_line =~ '^\s*}\|;\s*}'.endline " XXX + if ! isSingleLineBlock && previous_line =~ '^\s*}\|;\s*}'.endline call cursor(last_line_num, 1) if previous_line !~ '^}' @@ -740,14 +754,19 @@ function! GetPhpIndent() endif endif - let plinnum = GetLastRealCodeLNum(lnum - 1) + if (last_line !~ '^\s*}\%(}}\)\@!') + let plinnum = GetLastRealCodeLNum(lnum - 1) + else + let plinnum = GetLastRealCodeLNum(FindOpenBracket(lnum, 1) - 1) + endif + let AntepenultimateLine = getline(plinnum) let last_line = substitute(last_line,"\\(//\\|#\\)\\(\\(\\([^\"']*\\([\"']\\)[^\"']*\\5\\)\\+[^\"']*$\\)\\|\\([^\"']*$\\)\\)",'','') if ind == b:PHP_default_indenting - if last_line =~ terminated + if last_line =~ terminated && last_line !~# s:defaultORcase let LastLineClosed = 1 endif endif @@ -755,10 +774,10 @@ function! GetPhpIndent() if !LastLineClosed - if last_line =~# '[{(\[]'.endline || last_line =~? '\h\w*\s*(.*,$' && AntepenultimateLine !~ '[,(]'.endline + if last_line =~# '[{(\[]'.endline || last_line =~? '\h\w*\s*(.*,$' && AntepenultimateLine !~ '[,(\[]'.endline let dontIndent = 0 - if last_line =~ '\S\+\s*{'.endline && last_line !~ '^\s*\%(' . s:blockstart . '\)\|'. s:functionDecl . s:endline + if last_line =~ '\S\+\s*{'.endline && last_line !~ '^\s*)\s*{'.endline && last_line !~ '^\s*\%(' . s:blockstart . '\)\|'. s:functionDecl . s:endline let dontIndent = 1 endif @@ -774,7 +793,7 @@ function! GetPhpIndent() elseif last_line =~ '\S\+\s*),'.endline call cursor(lnum, 1) - call search('),'.endline, 'W') " line never begins with ) so no need for 'c' flag + call search('),'.endline, 'W') let openedparent = searchpair('(', '', ')', 'bW', 'Skippmatch()') if openedparent != lnum let ind = indent(openedparent) @@ -784,7 +803,7 @@ function! GetPhpIndent() let ind = ind + &sw - elseif AntepenultimateLine =~ '\%(;\%(\s*\%(?>\|}\)\)\=\|<<<''\=\a\w*''\=$\|^\s*}\|{\)'.endline . '\|' . s:defaultORcase + elseif AntepenultimateLine =~ '{'.endline || AntepenultimateLine =~ terminated || AntepenultimateLine =~# s:defaultORcase let ind = ind + &sw endif diff --git a/runtime/macros/editexisting.vim b/runtime/macros/editexisting.vim index c18f22569f..3530e29dc4 100644 --- a/runtime/macros/editexisting.vim +++ b/runtime/macros/editexisting.vim @@ -1,6 +1,6 @@ " Vim Plugin: Edit the file with an existing Vim if possible " Maintainer: Bram Moolenaar -" Last Change: 2013 Feb 24 +" Last Change: 2014 Dec 06 " This is a plugin, drop it in your (Unix) ~/.vim/plugin or (Win32) " $VIM/vimfiles/plugin directory. Or make a symbolic link, so that you @@ -112,7 +112,7 @@ func! EditExisting(fname, command) endif if a:command != '' - exe "normal " . a:command + exe "normal! " . a:command endif redraw diff --git a/runtime/syntax/zimbu.vim b/runtime/syntax/zimbu.vim index c859a2f815..1a7a485e6f 100644 --- a/runtime/syntax/zimbu.vim +++ b/runtime/syntax/zimbu.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Zimbu " Maintainer: Bram Moolenaar -" Last Change: 2012 Jun 01 +" Last Change: 2014 Nov 23 if exists("b:current_syntax") finish @@ -12,7 +12,10 @@ syn include @Ccode syntax/c.vim syn keyword zimbuTodo TODO FIXME XXX contained syn match zimbuNoBar "|" contained syn match zimbuParam "|[^| ]\+|" contained contains=zimbuNoBar -syn match zimbuComment "#.*$" contains=zimbuTodo,zimbuParam,@Spell +syn match zimbuNoBacktick "`" contained +syn match zimbuCode "`[^`]\+`" contained contains=zimbuNoBacktick +syn match zimbuComment "#.*$" contains=zimbuTodo,zimbuParam,zimbuCode,@Spell +syn match zimbuComment "/\*.\{-}\*/" contains=zimbuTodo,zimbuParam,zimbuCode,@Spell syn match zimbuChar "'\\\=.'" @@ -28,27 +31,32 @@ syn keyword zimbuBasicType fixed1 fixed2 fixed3 fixed4 fixed5 fixed6 syn keyword zimbuBasicType fixed7 fixed8 fixed9 fixed10 fixed11 fixed12 syn keyword zimbuBasicType fixed13 fixed14 fixed15 -syn keyword zimbuCompType string stringval cstring varstring -syn keyword zimbuCompType bytes varbytes -syn keyword zimbuCompType tuple array list dict multiDict set multiSet +syn keyword zimbuCompType string varString +syn keyword zimbuCompType byteString varByteString +syn keyword zimbuCompType tuple array list dict dictList set callback +syn keyword zimbuCompType sortedList multiDict multiDictList multiSet syn keyword zimbuCompType complex complex32 complex64 complex80 complex128 syn keyword zimbuCompType proc func def thread evalThread lock cond pipe -syn keyword zimbuType VAR ANY USE GET +syn keyword zimbuType VAR dyn type USE GET syn match zimbuType "IO.File" syn match zimbuType "IO.Stat" -syn keyword zimbuStatement IF ELSE ELSEIF WHILE REPEAT FOR IN TO STEP +syn keyword zimbuStatement IF ELSE ELSEIF IFNIL WHILE REPEAT FOR IN TO STEP syn keyword zimbuStatement DO UNTIL SWITCH WITH syn keyword zimbuStatement TRY CATCH FINALLY syn keyword zimbuStatement GENERATE_IF GENERATE_ELSE GENERATE_ELSEIF +syn keyword zimbuStatement GENERATE_ERROR +syn keyword zimbuStatement BUILD_IF BUILD_ELSE BUILD_ELSEIF syn keyword zimbuStatement CASE DEFAULT FINAL ABSTRACT VIRTUAL DEFINE REPLACE syn keyword zimbuStatement IMPLEMENTS EXTENDS PARENT LOCAL -syn keyword zimbuStatement PART ALIAS CONNECT WRAP +syn keyword zimbuStatement PART ALIAS TYPE CONNECT WRAP syn keyword zimbuStatement BREAK CONTINUE PROCEED -syn keyword zimbuStatement RETURN EXIT THROW +syn keyword zimbuStatement RETURN EXIT THROW DEFER syn keyword zimbuStatement IMPORT AS OPTIONS MAIN -syn keyword zimbuStatement INTERFACE MODULE ENUM BITS SHARED +syn keyword zimbuStatement INTERFACE PIECE INCLUDE MODULE ENUM BITS +syn keyword zimbuStatement SHARED STATIC +syn keyword zimbuStatement LAMBDA syn match zimbuStatement "\<\(FUNC\|PROC\|DEF\)\>" syn match zimbuStatement "\<CLASS\>" syn match zimbuStatement "}" @@ -61,10 +69,13 @@ syn match zimbuAttribute "@default\>" syn match zimbuAttribute "@define\>" syn match zimbuAttribute "@replace\>" syn match zimbuAttribute "@final\>" +syn match zimbuAttribute "@primitive\>" +syn match zimbuAttribute "@notOnExit\>" syn match zimbuAttribute "@private\>" syn match zimbuAttribute "@protected\>" syn match zimbuAttribute "@public\>" +syn match zimbuAttribute "@local\>" syn match zimbuAttribute "@file\>" syn match zimbuAttribute "@directory\>" syn match zimbuAttribute "@read=private\>" @@ -78,15 +89,22 @@ syn match zimbuAttribute "@items=public\>" syn match zimbuAttribute "@items=file\>" syn match zimbuAttribute "@items=directory\>" -syn keyword zimbuMethod NEW EQUAL COPY COMPARE SIZE GET SET +syn keyword zimbuMethod NEW EQUAL COPY COMPARE SIZE GET SET INIT EARLYINIT syn keyword zimbuOperator IS ISNOT ISA ISNOTA -syn keyword zimbuModule ARG CHECK E IO PROTO SYS HTTP ZC ZWT TIME THREAD +syn keyword zimbuModule ARG CHECK E GC IO LOG PROTO SYS HTTP ZC ZWT T TIME THREAD -syn match zimbuString +"\([^"\\]\|\\.\)*\("\|$\)+ +syn match zimbuImport "\.\zsPROTO" +syn match zimbuImport "\.\zsCHEADER" + +"syn match zimbuString +"\([^"\\]\|\\.\)*\("\|$\)+ contains=zimbuStringExpr +syn region zimbuString start=+"+ skip=+[^"\\]\|\\.+ end=+"\|$+ contains=zimbuStringExpr syn match zimbuString +R"\([^"]\|""\)*\("\|$\)+ -syn region zimbuString start=+'''+ end=+'''+ +syn region zimbuLongString start=+''"+ end=+"''+ +syn match zimbuStringExpr +\\([^)]*)+hs=s+2,he=e-1 contained contains=zimbuString,zimbuParenPairOuter +syn region zimbuParenPairOuter start=+(+ms=s+1 end=+)+me=e-1 contained contains=zimbuString,zimbuParenPair +syn region zimbuParenPair start=+(+ end=+)+ contained contains=zimbuString,zimbuParenPair syn keyword zimbuFixed TRUE FALSE NIL THIS THISTYPE FAIL OK syn keyword zimbuError NULL @@ -97,12 +115,18 @@ syn match zimbuSpaceError display excludenl "\S\s\+$"ms=s+1 syn match zimbuSpaceError display " \+\t" syn match zimbuSpaceError display "\t\+ " -syn match zimbuUses contained "uses([a-zA-Z_ ,]*)" +syn match zimbuUses contained "\<uses([a-zA-Z_ ,]*)" +syn match zimbuBlockgc contained "blockgc" syn match zimbuBlockComment contained " #.*" -syn region zimbuCregion matchgroup=zimbuCblock start="^>>>" end="^<<<.*" contains=@Ccode,zimbuUses,zimbuBlockComment keepend +syn region zimbuCregion matchgroup=zimbuCblock start="^>>>" end="^<<<.*" contains=@Ccode,zimbuUses,zimbuBlockgc,zimbuBlockComment keepend + +" Assume long strings and C regions don't take more than 200 lines. +syn sync minlines=200 -syn sync minlines=2000 +" When we find the start of a long string, without a # or " before it, we are +" sure to be inside a long string. +syn sync match zimbuLongStringSync grouphere zimbuLongString +^[^"#]*''\"+ hi def link zimbuBasicType Type hi def link zimbuCompType Type @@ -111,17 +135,23 @@ hi def link zimbuStatement Statement hi def link zimbuOperator Statement hi def link zimbuMethod PreProc hi def link zimbuModule PreProc +hi def link zimbuImport PreProc hi def link zimbuUses PreProc +hi def link zimbuBlockgc PreProc hi def link zimbuAttribute PreProc hi def link zimbuString Constant +hi def link zimbuLongString Special hi def link zimbuChar Constant hi def link zimbuFixed Constant hi def link zimbuComment Comment +hi def link zimbuCommentStart zimbuComment hi def link zimbuBlockComment Comment hi def link zimbuCblock Comment hi def link zimbuTodo Todo hi def link zimbuParam Constant +hi def link zimbuCode Statement hi def link zimbuNoBar Ignore +hi def link zimbuNoBacktick Ignore hi def link zimbuSpaceError Error hi def link zimbuError Error |