diff options
author | Bram Moolenaar <Bram@vim.org> | 2014-12-06 23:33:00 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2014-12-06 23:33:00 +0100 |
commit | ed32d9424d12f93dcdb96f2a5c512f7ad9945bee (patch) | |
tree | b28f74330874a2e939fc58d43b9da9af6336692d /runtime | |
parent | f8a447c6dc51e55d38d72c7a893c7483de112cdb (diff) |
Update runtime files.
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/autoload/phpcomplete.vim | 74 | ||||
-rw-r--r-- | runtime/doc/editing.txt | 25 | ||||
-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/tabpage.txt | 2 | ||||
-rw-r--r-- | runtime/doc/todo.txt | 97 | ||||
-rw-r--r-- | runtime/doc/windows.txt | 17 | ||||
-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 |
12 files changed, 277 insertions, 119 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 a71cbc0047..71f2f8c25c 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1,4 +1,4 @@ -*editing.txt* For Vim version 7.4. Last change: 2014 Nov 19 +*editing.txt* For Vim version 7.4. Last change: 2014 Dec 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -611,7 +611,7 @@ list of the current window. :[count]arga[dd] {name} .. *:arga* *:argadd* *E479* :[count]arga[dd] Add the {name}s to the argument list. When {name} is - omitted at the current buffer name to the argument + 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. @@ -622,7 +622,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. @@ -644,11 +645,19 @@ list of the current window. < {not in Vi} {not available when compiled without the |+listcmds| feature} -:{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. {not in Vi} {not available when compiled without the |+listcmds| feature} @@ -1082,7 +1091,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 7b3b9589b8..21df37f301 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 @@ -3305,6 +3305,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 @@ -3515,7 +3526,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 ee91a91acb..efb7bda661 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 @@ -5065,6 +5065,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/tabpage.txt b/runtime/doc/tabpage.txt index b795dbe552..47e1a4b674 100644 --- a/runtime/doc/tabpage.txt +++ b/runtime/doc/tabpage.txt @@ -1,4 +1,4 @@ -*tabpage.txt* For Vim version 7.4. Last change: 2012 Aug 08 +*tabpage.txt* For Vim version 7.4. Last change: 2014 Nov 27 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 2957b29491..04f9a44b95 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 + VMS: Select() doesn't work properly, typing ESC may hang Vim. Use sys$qiow instead. (Samuel Ferencik, 2013 Sep 28) @@ -548,6 +582,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 @@ -874,7 +916,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) @@ -1534,13 +1576,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 2830a04b84..67925b864a 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 @@ -278,16 +278,17 @@ CTRL-W CTRL-Q *CTRL-W_CTRL-Q* and there is only one window for the current buffer, and the buffer was changed, the command fails. - (Note: CTRL-Q does not - work on all terminals). If [count] is greater than - the last window number the last window will be closed: > + (Note: CTRL-Q does not work on all terminals). + + If [count] is greater than the last window number the last + window will be closed: > :1quit " quit the first window :$quit " quit the last window :9quit " quit the last window " if there are less than 9 windows opened :-quit " quit the previews window :+quit " quit the next window - :+2quit " will also work as expected + :+2quit " quit the second next window < :q[uit]! :{count}q[uit]! @@ -332,9 +333,9 @@ CTRL-W CTRL-C *CTRL-W_CTRL-C* screen. For {count} see |:quit| command. 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 this is a diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 508f19820b..e55642d142 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") @@ -1856,7 +1856,7 @@ au BufNewFile,BufRead sgml.catalog* call s:StarSetf('catalog') " Shell scripts (sh, ksh, bash, bash2, csh); Allow .profile_foo etc. " Gentoo ebuilds are actually bash scripts -au BufNewFile,BufRead .bashrc*,bashrc,bash.bashrc,.bash_profile*,.bash_logout*,*.bash,*.ebuild call SetFileTypeSH("bash") +au BufNewFile,BufRead .bashrc*,bashrc,bash.bashrc,.bash_profile*,.bash_logout*,.bash_aliases*,*.bash,*.ebuild call SetFileTypeSH("bash") au BufNewFile,BufRead .kshrc*,*.ksh call SetFileTypeSH("ksh") au BufNewFile,BufRead */etc/profile,.profile*,*.sh,*.env call SetFileTypeSH(getline(1)) @@ -2502,6 +2502,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/zimb |