1
0
forked from aniani/vim

Runtime file updates.

This commit is contained in:
Bram Moolenaar 2014-05-01 14:08:19 +02:00
parent b96c69d80e
commit bcb9898eba
8 changed files with 164 additions and 71 deletions

View File

@ -1,4 +1,4 @@
*digraph.txt* For Vim version 7.4. Last change: 2013 Dec 12 *digraph.txt* For Vim version 7.4. Last change: 2014 Apr 17
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*eval.txt* For Vim version 7.4. Last change: 2014 Apr 06 *eval.txt* For Vim version 7.4. Last change: 2014 Apr 29
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -2735,7 +2735,8 @@ exists({expr}) The result is a Number, which is non-zero if {expr} is
string) string)
*funcname built-in function (see |functions|) *funcname built-in function (see |functions|)
or user defined function (see or user defined function (see
|user-functions|). |user-functions|). Also works for a
variable that is a Funcref.
varname internal variable (see varname internal variable (see
|internal-variables|). Also works |internal-variables|). Also works
for |curly-braces-names|, |Dictionary| for |curly-braces-names|, |Dictionary|
@ -6464,10 +6465,11 @@ There are three types of features:
included. included.
4. Beyond a certain version or at a certain version and including a specific 4. Beyond a certain version or at a certain version and including a specific
patch. The "patch-7.4.123" feature means that the Vim version is 7.5 or patch. The "patch-7.4.237" feature means that the Vim version is 7.5 or
later, or it is version 7.4 and patch 123 was included. later, or it is version 7.4 and patch 237 was included.
The example above can be simplified to: > Note that this only works for patch 7.4.237 and later, before that you
:if has("patch-6.2.148") need to use the example above that checks v:version. Example: >
:if has("patch-7.4.248")
< Note that it's possible for patch 147 to be omitted even though 148 is < Note that it's possible for patch 147 to be omitted even though 148 is
included. included.
@ -6690,6 +6692,8 @@ can only be called from within the script and from functions, user commands
and autocommands defined in the script. It is also possible to call the and autocommands defined in the script. It is also possible to call the
function from a mapping defined in the script, but then |<SID>| must be used function from a mapping defined in the script, but then |<SID>| must be used
instead of "s:" when the mapping is expanded outside of the script. instead of "s:" when the mapping is expanded outside of the script.
There are only script-local functions, no buffer-local or window-local
functions.
*:fu* *:function* *E128* *E129* *E123* *:fu* *:function* *E128* *E129* *E123*
:fu[nction] List all functions and their arguments. :fu[nction] List all functions and their arguments.
@ -6713,12 +6717,15 @@ last defined. Example: >
< <
See |:verbose-cmd| for more information. See |:verbose-cmd| for more information.
*E124* *E125* *E853* *E124* *E125* *E853* *E884*
:fu[nction][!] {name}([arguments]) [range] [abort] [dict] :fu[nction][!] {name}([arguments]) [range] [abort] [dict]
Define a new function by the name {name}. The name Define a new function by the name {name}. The name
must be made of alphanumeric characters and '_', and must be made of alphanumeric characters and '_', and
must start with a capital or "s:" (see above). When must start with a capital or "s:" (see above). Note
using a capital "g:" be prepended. that using "b:" or "g:" is not allowed. (since patch
7.4.260 E884 is given if the function name has a colon
in the name, e.g. for "foo:bar()". Before that patch
no error was given).
{name} can also be a |Dictionary| entry that is a {name} can also be a |Dictionary| entry that is a
|Funcref|: > |Funcref|: >

View File

@ -1,4 +1,4 @@
*indent.txt* For Vim version 7.4. Last change: 2013 Nov 05 *indent.txt* For Vim version 7.4. Last change: 2014 Apr 23
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -812,7 +812,7 @@ OPTIONS: ~
PHP indenting can be altered in several ways by modifying the values of some PHP indenting can be altered in several ways by modifying the values of some
global variables: global variables:
*php-comment* *php-comment* *PHP_autoformatcomment*
To not enable auto-formating of comments by default (if you want to use your To not enable auto-formating of comments by default (if you want to use your
own 'formatoptions'): > own 'formatoptions'): >
:let g:PHP_autoformatcomment = 0 :let g:PHP_autoformatcomment = 0
@ -821,6 +821,7 @@ Else, 't' will be removed from the 'formatoptions' string and "qrowcb" will be
added, see |fo-table| for more information. added, see |fo-table| for more information.
------------- -------------
*PHP_outdentSLComments*
To add extra indentation to single-line comments: > To add extra indentation to single-line comments: >
:let g:PHP_outdentSLComments = N :let g:PHP_outdentSLComments = N
@ -832,6 +833,7 @@ Only single-line comments will be affected such as: >
/* Comment */ /* Comment */
------------- -------------
*PHP_default_indenting*
To add extra indentation to every PHP lines with N being the number of To add extra indentation to every PHP lines with N being the number of
'shiftwidth' to add: > 'shiftwidth' to add: >
:let g:PHP_default_indenting = N :let g:PHP_default_indenting = N
@ -851,14 +853,18 @@ For example, with N = 1, this will give:
(Notice the extra indentation between the PHP container markers and the code) (Notice the extra indentation between the PHP container markers and the code)
------------- -------------
To indent PHP tags as the surrounding code: > *PHP_outdentphpescape*
:let g:PHP_outdentphpescape = 0 To indent PHP escape tags as the surrounding non-PHP code (only affects the
PHP escape tags): >
:let g:PHP_outdentphpescape = 0
------------- -------------
*PHP_removeCRwhenUnix*
To automatically remove '\r' characters when the 'fileformat' is set to Unix: > To automatically remove '\r' characters when the 'fileformat' is set to Unix: >
:let g:PHP_removeCRwhenUnix = 1 :let g:PHP_removeCRwhenUnix = 1
------------- -------------
*PHP_BracesAtCodeLevel*
To indent braces at the same level than the code they contain: > To indent braces at the same level than the code they contain: >
:let g:PHP_BracesAtCodeLevel = 1 :let g:PHP_BracesAtCodeLevel = 1
@ -877,6 +883,7 @@ NOTE: Indenting will be a bit slower if this option is used because some
optimizations won't be available. optimizations won't be available.
------------- -------------
*PHP_vintage_case_default_indent*
To indent 'case:' and 'default:' statements in switch() blocks: > To indent 'case:' and 'default:' statements in switch() blocks: >
:let g:PHP_vintage_case_default_indent = 1 :let g:PHP_vintage_case_default_indent = 1

View File

@ -1,4 +1,4 @@
*options.txt* For Vim version 7.4. Last change: 2014 Mar 23 *options.txt* For Vim version 7.4. Last change: 2014 Apr 29
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -6619,6 +6619,10 @@ A jump table for the options with a short description can be found at |Q_op|.
top of the suggestion list with the internal methods. top of the suggestion list with the internal methods.
Lines without a slash are ignored, use this for Lines without a slash are ignored, use this for
comments. comments.
The word in the second column must be correct,
otherwise it will not be used. Add the word to an
".add" file if it is currently flagged as a spelling
mistake.
The file is used for all languages. The file is used for all languages.
expr:{expr} Evaluate expression {expr}. Use a function to avoid expr:{expr} Evaluate expression {expr}. Use a function to avoid

View File

@ -4312,6 +4312,7 @@ E880 if_pyth.txt /*E880*
E881 autocmd.txt /*E881* E881 autocmd.txt /*E881*
E882 eval.txt /*E882* E882 eval.txt /*E882*
E883 eval.txt /*E883* E883 eval.txt /*E883*
E884 eval.txt /*E884*
E89 message.txt /*E89* E89 message.txt /*E89*
E90 message.txt /*E90* E90 message.txt /*E90*
E91 options.txt /*E91* E91 options.txt /*E91*
@ -4441,6 +4442,13 @@ Operator-pending-mode intro.txt /*Operator-pending-mode*
OverTheSpot mbyte.txt /*OverTheSpot* OverTheSpot mbyte.txt /*OverTheSpot*
P change.txt /*P* P change.txt /*P*
PATHEXT eval.txt /*PATHEXT* PATHEXT eval.txt /*PATHEXT*
PHP_BracesAtCodeLevel indent.txt /*PHP_BracesAtCodeLevel*
PHP_autoformatcomment indent.txt /*PHP_autoformatcomment*
PHP_default_indenting indent.txt /*PHP_default_indenting*
PHP_outdentSLComments indent.txt /*PHP_outdentSLComments*
PHP_outdentphpescape indent.txt /*PHP_outdentphpescape*
PHP_removeCRwhenUnix indent.txt /*PHP_removeCRwhenUnix*
PHP_vintage_case_default_indent indent.txt /*PHP_vintage_case_default_indent*
Pattern pattern.txt /*Pattern* Pattern pattern.txt /*Pattern*
Perl if_perl.txt /*Perl* Perl if_perl.txt /*Perl*
Posix intro.txt /*Posix* Posix intro.txt /*Posix*

View File

@ -1,4 +1,4 @@
*todo.txt* For Vim version 7.4. Last change: 2014 Apr 05 *todo.txt* For Vim version 7.4. Last change: 2014 Apr 30
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -35,8 +35,6 @@ not be repeated below, unless there is extra information.
-------------------- Known bugs and current work ----------------------- -------------------- Known bugs and current work -----------------------
Regexp problems: Regexp problems:
- Crash when using cpp syntax file with raw string. (Havard Garnes)
Edit "~/tmp/test.cc" and source "~/tmp/cpp.vim".
- NFA regexp doesn't count tab matches correctly. (Urtica Dioica / gaultheria - NFA regexp doesn't count tab matches correctly. (Urtica Dioica / gaultheria
Shallon, 2013 Nov 18) Shallon, 2013 Nov 18)
- After patch 7.4.100 there is still a difference between NFA and old engine. - After patch 7.4.100 there is still a difference between NFA and old engine.
@ -53,41 +51,32 @@ Regexp problems:
- Bug with back references. (Lech Lorens, 2014 Feb 3) - Bug with back references. (Lech Lorens, 2014 Feb 3)
- Bug when using \>. (Ramel, 2014 Feb 2) (Aaron Bohannon, 2014 Feb 13) - Bug when using \>. (Ramel, 2014 Feb 2) (Aaron Bohannon, 2014 Feb 13)
Update for documentation of 'ttymouse' option. (Hayaki Saito, 2014 Apr 30)
Typo: s/support/supports/
Problem that a previous silent ":throw" causes a following try/catch not to Problem that a previous silent ":throw" causes a following try/catch not to
work. (ZyX, 2013 Sep 28) work. (ZyX, 2013 Sep 28)
":cd C:\Windows\System32\drivers\etc*" does not work, even though the ":cd C:\Windows\System32\drivers\etc*" does not work, even though the
directory exists. (Sergio Gallelli, 2013 Dec 29) directory exists. (Sergio Gallelli, 2013 Dec 29)
It is possible to define a function with a colon in the name. Patch to fix positioning in tabs. (Nobuhiro Takasaki, 2014 Apr 25)
"g:" is not recognized as it should. (zyx, 2014 Mar 16) New way to reproduce it: 2014 Apr 29
Do some plugins use names with a colon? Disallow it, but ignore the error
when an option is set?
":lunmap" cannot be abbrevated to ":lu". (ZyX)
Problem using ":try" inside ":execute". (ZyX, 2013 Sep 15) Problem using ":try" inside ":execute". (ZyX, 2013 Sep 15)
Python: ":py raw_input('prompt')" doesn't work. (Manu Hack) Python: ":py raw_input('prompt')" doesn't work. (Manu Hack)
Crash in setqflist(). (Benoit Mortgat, 2010 Nov 18)
MS-Windows: Crash opening very long file name starting with "\\". MS-Windows: Crash opening very long file name starting with "\\".
(Christian Brock, 2012 Jun 29) (Christian Brock, 2012 Jun 29)
Crash in autocmd that unloads buffers in a BufUnload event. (Andrew Pimlott,
2012 Aug 11) Disallow :new when BufUnload is being handled?
Spell files use a latin single quote. Unicode also has another single quote.
Adjust spell file scripts to duplicate words to support both quotes.
(Ron Aaron, 2014 Apr 4)
Problem with 'spellsuggest' file, only works for some words.
(Cesar Romani, 2013 Aug 20) Depends on file name? (Aug 24)
Additional remark by glts: the suggested words are marked bad?
Syntax highlighting slow (hangs) in SASS file. (Niek Bosch, 2013 Aug 21) Syntax highlighting slow (hangs) in SASS file. (Niek Bosch, 2013 Aug 21)
Inconsistant error messages when comparing dict and when comparing list.
(ZyX, 2014 Apr 19)
Add #ifdef around struct members not used by GTK. (Cade Forester, 2014 Apr 10)
Adding "~" to 'cdpath' doesn't work for completion? (Davido, 2013 Aug 19) Adding "~" to 'cdpath' doesn't work for completion? (Davido, 2013 Aug 19)
Syntax file for gnuplot. Existing one is very old. (Andrew Rasmussen, 2014 Syntax file for gnuplot. Existing one is very old. (Andrew Rasmussen, 2014
@ -95,6 +84,8 @@ Feb 24)
Add digraph for Rouble: =P. What's the Unicode? Add digraph for Rouble: =P. What's the Unicode?
Include .hgignore in the distribution, so that patches for it work.
Issue 174: Detect Mason files. Issue 174: Detect Mason files.
No error for missing endwhile. (ZyX, 2014 Mar 20) No error for missing endwhile. (ZyX, 2014 Mar 20)
@ -103,6 +94,14 @@ Phpcomplete.vim update. (Complex, 2014 Jan 15)
PHP syntax is extremely slow. (Anhad Jai Singh, 2014 Jan 19) PHP syntax is extremely slow. (Anhad Jai Singh, 2014 Jan 19)
After setting 'spellfile' the screen is not redrawn. (issue 221)
Patch from Christian Brabandt on the issu.
Spell files use a latin single quote. Unicode also has another single quote:
0x2019. (Ron Aaron, 2014 Apr 4)
New OpenOffice spell files support this with ICONV. But they are not
compatible with Vim spell files. The old files can no longer be downloaded.
Win32: use different args for SearchPath()? (Yasuhiro Matsumoto, 2009 Jan 30) Win32: use different args for SearchPath()? (Yasuhiro Matsumoto, 2009 Jan 30)
Also fixes wrong result from executable(). Also fixes wrong result from executable().
Update from Ken Takata, 2014 Jan 10. Newer 2014 Apr 3. Update from Ken Takata, 2014 Jan 10. Newer 2014 Apr 3.
@ -110,6 +109,9 @@ Update from Ken Takata, 2014 Jan 10. Newer 2014 Apr 3.
Can we make ":unlet $VAR" use unsetenv() to delete the env var? Can we make ":unlet $VAR" use unsetenv() to delete the env var?
What for systems that don't have unsetenv()? What for systems that don't have unsetenv()?
Patch for problem that v:register is set to '_' after deleting into the black
hole register.
This does not give an error: (Andre Sihera, 2014 Mar 21) This does not give an error: (Andre Sihera, 2014 Mar 21)
vim -u NONE 1 2 3 -c 'bufdo if 1 | echo 1' vim -u NONE 1 2 3 -c 'bufdo if 1 | echo 1'
This neither: (ZyX) This neither: (ZyX)
@ -119,6 +121,9 @@ This neither: (ZyX)
Change 'viewdir' to "$HOME/vimfiles/view" and use 'viewdiralt' to also read Change 'viewdir' to "$HOME/vimfiles/view" and use 'viewdiralt' to also read
from? from?
Patch to add arglistid(), get the ID of the currently used argument list.
(Marcin Szamotulski, 2014 Apr 27)
Include a plugin manager with Vim? Neobundle seems to be the best currently. Include a plugin manager with Vim? Neobundle seems to be the best currently.
Long message about this from ZyX, 2014 Mar 23. And following replies. Long message about this from ZyX, 2014 Mar 23. And following replies.
Also see http://vim-wiki.mawercer.de/wiki/topic/vim%20plugin%20managment.html Also see http://vim-wiki.mawercer.de/wiki/topic/vim%20plugin%20managment.html
@ -156,6 +161,9 @@ Out of scope:
Setting the spell file in a session only reads the local additions, not the Setting the spell file in a session only reads the local additions, not the
normal spell file. (Enno Nagel, 2014 Mar 29) normal spell file. (Enno Nagel, 2014 Mar 29)
When typing the first character of a command, e.g. "f", then using a menu, the
menu item doesn't work. Clear typeahead when using a menu?
Editing an ascii file as ucs-2 or ucs-4 causes display errors. Editing an ascii file as ucs-2 or ucs-4 causes display errors.
(ZyX, 2014 Mar 30) (ZyX, 2014 Mar 30)
@ -1154,6 +1162,7 @@ is executed.
":pedit %" with a BufReadPre autocommand causes the cursor to move to the ":pedit %" with a BufReadPre autocommand causes the cursor to move to the
first line. (Ingo Karkat, 2008 Jul 1) Ian Kelling is working on this. first line. (Ingo Karkat, 2008 Jul 1) Ian Kelling is working on this.
Similar problem with ":e". (Marc Montu, 2014 Apr 22)
Wildmenu not deleted: "gvim -u NONE", ":set nocp wildmenu cmdheight=3 Wildmenu not deleted: "gvim -u NONE", ":set nocp wildmenu cmdheight=3
laststatus=2", CTRL-D CTRL-H CTRL-H CTRL-H. (A.Politz, 2008 April 1) laststatus=2", CTRL-D CTRL-H CTRL-H CTRL-H. (A.Politz, 2008 April 1)
@ -1501,6 +1510,7 @@ Engelke, 2007 Dec 20 - 2008 Jan 17)
Win64: Seek error in swap file for a very big file (3 Gbyte). Check storing Win64: Seek error in swap file for a very big file (3 Gbyte). Check storing
pointer in long and seek offset in 64 bit var. pointer in long and seek offset in 64 bit var.
Patches from Ken Takata might help (2014 Apr 17)
Win32: patch for fullscreen mode. (Liushaolin, 2008 April 17) Win32: patch for fullscreen mode. (Liushaolin, 2008 April 17)

View File

@ -3,8 +3,8 @@
" Author: John Wellesz <John.wellesz (AT) teaser (DOT) fr> " Author: John Wellesz <John.wellesz (AT) teaser (DOT) fr>
" URL: http://www.2072productions.com/vim/indent/php.vim " URL: http://www.2072productions.com/vim/indent/php.vim
" Home: https://github.com/2072/PHP-Indenting-for-VIm " Home: https://github.com/2072/PHP-Indenting-for-VIm
" Last Change: 2014 Jan 21 " Last Change: 2014 April 3rd
" Version: 1.39 " Version: 1.49
" "
" "
" Type :help php-indent for available options " Type :help php-indent for available options
@ -39,7 +39,8 @@
" "
" or simply 'let' the option PHP_removeCRwhenUnix to 1 and the script will " or simply 'let' the option PHP_removeCRwhenUnix to 1 and the script will
" silently remove them when VIM load this script (at each bufread). " silently remove them when VIM load this script (at each bufread).
"
if exists("b:did_indent") if exists("b:did_indent")
finish finish
@ -126,14 +127,26 @@ if exists("*GetPhpIndent")
finish " XXX -- comment this line for easy dev finish " XXX -- comment this line for easy dev
endif endif
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:endline= '\s*\%(//.*\|#.*\|/\*.*\*/\s*\)\=$' let s:endline= '\s*\%(//.*\|#.*\|/\*.*\*/\s*\)\=$'
let s:terminated = '\%(\%(;\%(\s*\%(?>\|}\)\)\=\|<<<''\=\a\w*''\=$\|^\s*}\)'.s:endline.'\)\|^[^''"`]*[''"`]$'
let s:PHP_startindenttag = '<?\%(.*?>\)\@!\|<script[^>]*>\%(.*<\/script>\)\@!' let s:PHP_startindenttag = '<?\%(.*?>\)\@!\|<script[^>]*>\%(.*<\/script>\)\@!'
let s:escapeDebugStops = 0
function! DebugPrintReturn(scriptLine) function! DebugPrintReturn(scriptLine)
if ! s:escapeDebugStops
echo "debug:" . a:scriptLine echo "debug:" . a:scriptLine
call getchar() let c = getchar()
if c == "\<Del>"
let s:escapeDebugStops = 1
end
endif
endfunction endfunction
@ -190,6 +203,11 @@ function! GetLastRealCodeLNum(startline) " {{{
while getline(lnum) !~? tofind && lnum > 1 while getline(lnum) !~? tofind && lnum > 1
let lnum = lnum - 1 let lnum = lnum - 1
endwhile endwhile
elseif lastline =~ '^[^''"`]*[''"`][;,]'.s:endline
let tofind=substitute( lastline, '^.*\([''"`]\)[;,].*$', '^[^\1]\\+[\1]$', '')
while getline(lnum) !~? tofind && lnum > 1
let lnum = lnum - 1
endwhile
else else
break break
endif endif
@ -226,9 +244,23 @@ function! Skippmatch() " {{{
endif endif
endfun " }}} endfun " }}}
function! FindOpenBracket(lnum) " {{{ function! FindOpenBracket(lnum, blockStarter) " {{{
call cursor(a:lnum, 1) call cursor(a:lnum, 1)
return searchpair('{', '', '}', 'bW', 'Skippmatch()') let line = searchpair('{', '', '}', 'bW', 'Skippmatch()')
if a:blockStarter == 1
while line > 1
let linec = getline(line)
if linec =~ s:terminated || linec =~ '^\s*\%(' . s:blockstart . '\)\|'. s:functionDecl . s:endline
break
endif
let line = GetLastRealCodeLNum(line - 1)
endwhile
endif
return line
endfun " }}} endfun " }}}
function! FindTheIfOfAnElse (lnum, StopAfterFirstPrevElse) " {{{ function! FindTheIfOfAnElse (lnum, StopAfterFirstPrevElse) " {{{
@ -248,7 +280,7 @@ function! FindTheIfOfAnElse (lnum, StopAfterFirstPrevElse) " {{{
endif endif
if getline(beforeelse) =~ '^\s*}' if getline(beforeelse) =~ '^\s*}'
let beforeelse = FindOpenBracket(beforeelse) let beforeelse = FindOpenBracket(beforeelse, 0)
if getline(beforeelse) =~ '^\s*{' if getline(beforeelse) =~ '^\s*{'
let beforeelse = GetLastRealCodeLNum(beforeelse - 1) let beforeelse = GetLastRealCodeLNum(beforeelse - 1)
@ -285,13 +317,13 @@ function! FindTheSwitchIndent (lnum) " {{{
return indent(1) - &sw * b:PHP_vintage_case_default_indent return indent(1) - &sw * b:PHP_vintage_case_default_indent
end end
if getline(test) =~ '^\s*}' while getline(test) =~ '^\s*}' && test > 1
let test = FindOpenBracket(test) let test = GetLastRealCodeLNum(FindOpenBracket(test, 0) - 1)
if getline(test) =~ '^\s*{' if getline(test) =~ '^\s*switch\>'
let test = GetLastRealCodeLNum(GetLastRealCodeLNum(test - 1) - 1) let test = GetLastRealCodeLNum(test - 1)
endif
endif endif
endwhile
if getline(test) =~# '^\s*switch\>' if getline(test) =~# '^\s*switch\>'
return indent(test) return indent(test)
@ -308,7 +340,7 @@ function! IslinePHP (lnum, tofind) " {{{
let cline = getline(a:lnum) let cline = getline(a:lnum)
if a:tofind=="" if a:tofind==""
let tofind = "^\\s*[\"']*\\s*\\zs\\S" let tofind = "^\\s*[\"'`]*\\s*\\zs\\S"
else else
let tofind = a:tofind let tofind = a:tofind
endif endif
@ -319,6 +351,14 @@ function! IslinePHP (lnum, tofind) " {{{
let synname = synIDattr(synID(a:lnum, coltotest, 0), "name") let synname = synIDattr(synID(a:lnum, coltotest, 0), "name")
if synname == 'phpStringSingle' || synname == 'phpStringDouble' || synname == 'phpBacktick'
if cline !~ '^\s*[''"`]'
return ""
else
return synname
end
end
if get(s:SynPHPMatchGroups, synname) || synname =~ '^php' || synname =~? '^javaScript' if get(s:SynPHPMatchGroups, synname) || synname =~ '^php' || synname =~? '^javaScript'
return synname return synname
else else
@ -326,9 +366,6 @@ function! IslinePHP (lnum, tofind) " {{{
endif endif
endfunction " }}} endfunction " }}}
let s:notPhpHereDoc = '\%(break\|return\|continue\|exit\|die\|else\)'
let s:blockstart = '\%(\%(\%(}\s*\)\=else\%(\s\+\)\=\)\=if\>\|else\>\|while\>\|switch\>\|case\>\|default\>\|for\%(each\)\=\>\|declare\>\|class\>\|interface\>\|abstract\>\|try\>\|catch\>\)'
let s:autoresetoptions = 0 let s:autoresetoptions = 0
if ! s:autoresetoptions if ! s:autoresetoptions
let s:autoresetoptions = 1 let s:autoresetoptions = 1
@ -344,7 +381,6 @@ function! ResetPhpOptions()
setlocal formatoptions+=q setlocal formatoptions+=q
setlocal formatoptions+=r setlocal formatoptions+=r
setlocal formatoptions+=o setlocal formatoptions+=o
setlocal formatoptions+=w
setlocal formatoptions+=c setlocal formatoptions+=c
setlocal formatoptions+=b setlocal formatoptions+=b
endif endif
@ -443,6 +479,7 @@ function! GetPhpIndent()
" Test if we are indenting PHP code {{{ " Test if we are indenting PHP code {{{
let lnum = prevnonblank(v:lnum - 1) let lnum = prevnonblank(v:lnum - 1)
let last_line = getline(lnum) let last_line = getline(lnum)
let endline= s:endline
if b:InPHPcode_tofind!="" if b:InPHPcode_tofind!=""
if cline =~? b:InPHPcode_tofind if cline =~? b:InPHPcode_tofind
@ -483,6 +520,9 @@ function! GetPhpIndent()
let b:InPHPcode_and_script = 1 let b:InPHPcode_and_script = 1
endif endif
elseif last_line =~ '^[^''"`]\+[''"`]$' " a string identifier with nothing after it and no other string identifier before
let b:InPHPcode = 0
let b:InPHPcode_tofind = substitute( last_line, '^.*\([''"`]\).*$', '^[^\1]*\1[;,]$', '')
elseif last_line =~? '<<<''\=\a\w*''\=$' elseif last_line =~? '<<<''\=\a\w*''\=$'
let b:InPHPcode = 0 let b:InPHPcode = 0
let b:InPHPcode_tofind = substitute( last_line, '^.*<<<''\=\(\a\w*\)''\=$', '^\\s*\1;\\=$', '') let b:InPHPcode_tofind = substitute( last_line, '^.*<<<''\=\(\a\w*\)''\=$', '^\\s*\1;\\=$', '')
@ -545,7 +585,7 @@ function! GetPhpIndent()
return 0 return 0
endif endif
if cline =~? '^\s*\a\w*;$\|^\a\w*$' && cline !~? s:notPhpHereDoc if cline =~? '^\s*\a\w*;$\|^\a\w*$\|^\s*[''"`][;,]' && cline !~? s:notPhpHereDoc
return 0 return 0
endif " }}} endif " }}}
@ -555,7 +595,6 @@ function! GetPhpIndent()
let last_line = getline(lnum) let last_line = getline(lnum)
let ind = indent(lnum) let ind = indent(lnum)
let endline= s:endline
if ind==0 && b:PHP_default_indenting if ind==0 && b:PHP_default_indenting
let ind = b:PHP_default_indenting let ind = b:PHP_default_indenting
@ -567,7 +606,7 @@ function! GetPhpIndent()
if cline =~ '^\s*}\%(}}\)\@!' if cline =~ '^\s*}\%(}}\)\@!'
let ind = indent(FindOpenBracket(v:lnum)) let ind = indent(FindOpenBracket(v:lnum, 1))
let b:PHP_CurrentIndentLevel = b:PHP_default_indenting let b:PHP_CurrentIndentLevel = b:PHP_default_indenting
return ind return ind
endif endif
@ -599,7 +638,7 @@ function! GetPhpIndent()
let LastLineClosed = 0 let LastLineClosed = 0
let terminated = '\%(;\%(\s*\%(?>\|}\)\)\=\|<<<''\=\a\w*''\=$\|^\s*}\)'.endline let terminated = s:terminated
let unstated = '\%(^\s*'.s:blockstart.'.*)\|\%(//.*\)\@<!\<e'.'lse\>\)'.endline let unstated = '\%(^\s*'.s:blockstart.'.*)\|\%(//.*\)\@<!\<e'.'lse\>\)'.endline
@ -614,7 +653,7 @@ function! GetPhpIndent()
while last_line_num > 1 while last_line_num > 1
if previous_line =~ '^\s*\%(' . s:blockstart . '\|\%([a-zA-Z]\s*\)*function\)' if previous_line =~ terminated || previous_line =~ '^\s*\%(' . s:blockstart . '\)\|'. s:functionDecl . endline
let ind = indent(last_line_num) let ind = indent(last_line_num)
@ -625,7 +664,7 @@ function! GetPhpIndent()
return ind return ind
endif endif
let last_line_num = last_line_num - 1 let last_line_num = GetLastRealCodeLNum(last_line_num - 1)
let previous_line = getline(last_line_num) let previous_line = getline(last_line_num)
endwhile endwhile
@ -638,22 +677,29 @@ function! GetPhpIndent()
let last_line_num = lnum let last_line_num = lnum
let LastLineClosed = 1 let LastLineClosed = 1
let isSingleLineBlock = 0
while 1 while 1
if previous_line =~ '^\s*}\|;\s*}'.endline " XXX if ! isSingleLineBlock && previous_line =~ '^\s*}\|;\s*}'.endline " XXX
call cursor(last_line_num, 1) call cursor(last_line_num, 1)
call search('}\|;\s*}'.endline, 'cW') if previous_line !~ '^}'
call search('}\|;\s*}'.endline, 'W')
end
let oldLastLine = last_line_num let oldLastLine = last_line_num
let last_line_num = searchpair('{', '', '}', 'bW', 'Skippmatch()') let last_line_num = searchpair('{', '', '}', 'bW', 'Skippmatch()')
if oldLastLine == last_line_num || getline(last_line_num) =~ '^\s*{' if getline(last_line_num) =~ '^\s*{'
let last_line_num = GetLastRealCodeLNum(last_line_num - 1) let last_line_num = GetLastRealCodeLNum(last_line_num - 1)
elseif oldLastLine == last_line_num
let isSingleLineBlock = 1
continue
endif endif
let previous_line = getline(last_line_num) let previous_line = getline(last_line_num)
continue continue
else else
let isSingleLineBlock = 0
if getline(last_line_num) =~# '^\s*else\%(if\)\=\>' if getline(last_line_num) =~# '^\s*else\%(if\)\=\>'
let last_line_num = FindTheIfOfAnElse(last_line_num, 0) let last_line_num = FindTheIfOfAnElse(last_line_num, 0)
@ -711,7 +757,12 @@ function! GetPhpIndent()
if last_line =~# '[{(\[]'.endline || last_line =~? '\h\w*\s*(.*,$' && AntepenultimateLine !~ '[,(]'.endline if last_line =~# '[{(\[]'.endline || last_line =~? '\h\w*\s*(.*,$' && AntepenultimateLine !~ '[,(]'.endline
if !b:PHP_BracesAtCodeLevel || last_line !~# '^\s*{' let dontIndent = 0
if last_line =~ '\S\+\s*{'.endline && last_line !~ '^\s*\%(' . s:blockstart . '\)\|'. s:functionDecl . s:endline
let dontIndent = 1
endif
if !dontIndent && (!b:PHP_BracesAtCodeLevel || last_line !~# '^\s*{')
let ind = ind + &sw let ind = ind + &sw
endif endif
@ -723,7 +774,7 @@ function! GetPhpIndent()
elseif last_line =~ '\S\+\s*),'.endline elseif last_line =~ '\S\+\s*),'.endline
call cursor(lnum, 1) call cursor(lnum, 1)
call search('),'.endline, 'W') call search('),'.endline, 'W') " line never begins with ) so no need for 'c' flag
let openedparent = searchpair('(', '', ')', 'bW', 'Skippmatch()') let openedparent = searchpair('(', '', ')', 'bW', 'Skippmatch()')
if openedparent != lnum if openedparent != lnum
let ind = indent(openedparent) let ind = indent(openedparent)

View File

@ -4,8 +4,8 @@
" :3s+-foo++g " :3s+-foo++g
" Description: highlight dnsmasq configuration files " Description: highlight dnsmasq configuration files
" File: runtime/syntax/dnsmasq.vim " File: runtime/syntax/dnsmasq.vim
" Version: 2.67 " Version: 2.70
" Last Change: 2013 Nov 03 " Last Change: 2014 Apr 30
" Modeline: vim: ts=8:sw=2:sts=2: " Modeline: vim: ts=8:sw=2:sts=2:
" "
" License: VIM License " License: VIM License
@ -132,6 +132,9 @@ syn match DnsmasqKeyword "^\s*dhcp-subscrid\>"
syn match DnsmasqKeyword "^\s*dhcp-userclass\>" syn match DnsmasqKeyword "^\s*dhcp-userclass\>"
syn match DnsmasqKeyword "^\s*dhcp-vendorclass\>" syn match DnsmasqKeyword "^\s*dhcp-vendorclass\>"
syn match DnsmasqKeyword "^\s*dns-rr\>" syn match DnsmasqKeyword "^\s*dns-rr\>"
syn match DnsmasqKeyword "^\s*dnssec\>"
syn match DnsmasqKeyword "^\s*dnssec-check-unsigned\>"
syn match DnsmasqKeyword "^\s*dnssec-no-timecheck\>"
syn match DnsmasqKeyword "^\s*dns-forward-max\>" syn match DnsmasqKeyword "^\s*dns-forward-max\>"
syn match DnsmasqKeyword "^\s*domain\>" syn match DnsmasqKeyword "^\s*domain\>"
syn match DnsmasqKeyword "^\s*domain-needed\>" syn match DnsmasqKeyword "^\s*domain-needed\>"
@ -153,6 +156,7 @@ syn match DnsmasqKeyword "^\s*listen-address\>"
syn match DnsmasqKeyword "^\s*local\>" syn match DnsmasqKeyword "^\s*local\>"
syn match DnsmasqKeyword "^\s*localmx\>" syn match DnsmasqKeyword "^\s*localmx\>"
syn match DnsmasqKeyword "^\s*local-ttl\>" syn match DnsmasqKeyword "^\s*local-ttl\>"
syn match DnsmasqKeyword "^\s*local-service\>"
syn match DnsmasqKeyword "^\s*localise-queries\>" syn match DnsmasqKeyword "^\s*localise-queries\>"
syn match DnsmasqKeyword "^\s*log-async\>" syn match DnsmasqKeyword "^\s*log-async\>"
syn match DnsmasqKeyword "^\s*log-dhcp\>" syn match DnsmasqKeyword "^\s*log-dhcp\>"
@ -187,8 +191,10 @@ syn match DnsmasqKeyword "^\s*read-ethers\>"
syn match DnsmasqKeyword "^\s*rebind-domain-ok\>" syn match DnsmasqKeyword "^\s*rebind-domain-ok\>"
syn match DnsmasqKeyword "^\s*rebind-localhost-ok\>" syn match DnsmasqKeyword "^\s*rebind-localhost-ok\>"
syn match DnsmasqKeyword "^\s*resolv-file\>" syn match DnsmasqKeyword "^\s*resolv-file\>"
syn match DnsmasqKeyword "^\s*rev-server\>"
syn match DnsmasqKeyword "^\s*selfmx\>" syn match DnsmasqKeyword "^\s*selfmx\>"
syn match DnsmasqKeyword "^\s*server\>" syn match DnsmasqKeyword "^\s*server\>"
syn match DnsmasqKeyword "^\s*servers-file\>"
syn match DnsmasqKeyword "^\s*srv-host\>" syn match DnsmasqKeyword "^\s*srv-host\>"
syn match DnsmasqKeyword "^\s*stop-dns-rebind\>" syn match DnsmasqKeyword "^\s*stop-dns-rebind\>"
syn match DnsmasqKeyword "^\s*strict-order\>" syn match DnsmasqKeyword "^\s*strict-order\>"