vim-patch:cbebd48

Updated runtime files.

cbebd4879c

Ignore changes to
* doc/channel.txt, doc/eval.txt: Channel related docs
* doc/tags: Generated at build time
* doc/todo.txt: Not relevant to Neovim
* ftplugin/man.vim: Change already present in autoload/man.vim
This commit is contained in:
James McCoy
2016-06-05 15:48:49 -04:00
parent e2941ecfbe
commit 18cbe74af7

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 November 26th " Last Change: 2015 September 8th
" Version: 1.57 " Version: 1.60
" "
" "
" Type :help php-indent for available options " Type :help php-indent for available options
@@ -50,16 +50,25 @@ let b:did_indent = 1
let g:php_sync_method = 0 let g:php_sync_method = 0
if exists('*shiftwidth')
function! s:sw()
return shiftwidth()
endfunction
else
function! s:sw()
return &shiftwidth
endfunction
endif
if exists("PHP_default_indenting") if exists("PHP_default_indenting")
let b:PHP_default_indenting = PHP_default_indenting * &sw let b:PHP_default_indenting = PHP_default_indenting * s:sw()
else else
let b:PHP_default_indenting = 0 let b:PHP_default_indenting = 0
endif endif
if exists("PHP_outdentSLComments") if exists("PHP_outdentSLComments")
let b:PHP_outdentSLComments = PHP_outdentSLComments * &sw let b:PHP_outdentSLComments = PHP_outdentSLComments * s:sw()
else else
let b:PHP_outdentSLComments = 0 let b:PHP_outdentSLComments = 0
endif endif
@@ -124,7 +133,7 @@ endif
if exists("*GetPhpIndent") if exists("*GetPhpIndent")
call ResetPhpOptions() call ResetPhpOptions()
finish " XXX -- comment this line for easy dev finish
endif endif
@@ -135,7 +144,7 @@ let s:functionDecl = '\<function\>\%(\s\+'.s:PHP_validVariable.'\)\=\s*(.*'
let s:endline= '\s*\%(//.*\|#.*\|/\*.*\*/\s*\)\=$' let s:endline= '\s*\%(//.*\|#.*\|/\*.*\*/\s*\)\=$'
let s:terminated = '\%(\%(;\%(\s*\%(?>\|}\)\)\=\|<<<''\=\a\w*''\=$\|^\s*}\|^\s*'.s:PHP_validVariable.':\)'.s:endline.'\)\|^[^''"`]*[''"`]$' let s:terminated = '\%(\%(;\%(\s*\%(?>\|}\)\)\=\|<<<\s*[''"]\=\a\w*[''"]\=$\|^\s*}\|^\s*'.s:PHP_validVariable.':\)'.s:endline.'\)\|^[^''"`]*[''"`]$'
let s:PHP_startindenttag = '<?\%(.*?>\)\@!\|<script[^>]*>\%(.*<\/script>\)\@!' let s:PHP_startindenttag = '<?\%(.*?>\)\@!\|<script[^>]*>\%(.*<\/script>\)\@!'
@@ -200,7 +209,7 @@ function! GetLastRealCodeLNum(startline) " {{{
elseif lastline =~? '^\a\w*;\=$' && lastline !~? s:notPhpHereDoc elseif lastline =~? '^\a\w*;\=$' && lastline !~? s:notPhpHereDoc
let tofind=substitute( lastline, '\(\a\w*\);\=', '<<<''\\=\1''\\=$', '') let tofind=substitute( lastline, '\(\a\w*\);\=', '<<<\\s*[''"]\\=\1[''"]\\=$', '')
while getline(lnum) !~? tofind && lnum > 1 while getline(lnum) !~? tofind && lnum > 1
let lnum = lnum - 1 let lnum = lnum - 1
endwhile endwhile
@@ -314,7 +323,7 @@ function! FindTheSwitchIndent (lnum) " {{{
let test = GetLastRealCodeLNum(a:lnum - 1) let test = GetLastRealCodeLNum(a:lnum - 1)
if test <= 1 if test <= 1
return indent(1) - &sw * b:PHP_vintage_case_default_indent return indent(1) - s:sw() * b:PHP_vintage_case_default_indent
end end
while getline(test) =~ '^\s*}' && test > 1 while getline(test) =~ '^\s*}' && test > 1
@@ -328,7 +337,7 @@ function! FindTheSwitchIndent (lnum) " {{{
if getline(test) =~# '^\s*switch\>' if getline(test) =~# '^\s*switch\>'
return indent(test) return indent(test)
elseif getline(test) =~# s:defaultORcase elseif getline(test) =~# s:defaultORcase
return indent(test) - &sw * b:PHP_vintage_case_default_indent return indent(test) - s:sw() * b:PHP_vintage_case_default_indent
else else
return FindTheSwitchIndent(test) return FindTheSwitchIndent(test)
endif endif
@@ -401,7 +410,7 @@ function! GetPhpIndent()
endif endif
if b:PHP_default_indenting if b:PHP_default_indenting
let b:PHP_default_indenting = g:PHP_default_indenting * &sw let b:PHP_default_indenting = g:PHP_default_indenting * s:sw()
endif endif
let cline = getline(v:lnum) let cline = getline(v:lnum)
@@ -439,6 +448,7 @@ function! GetPhpIndent()
if !b:InPHPcode_checked " {{{ One time check if !b:InPHPcode_checked " {{{ One time check
let b:InPHPcode_checked = 1 let b:InPHPcode_checked = 1
let b:UserIsTypingComment = 0
let synname = "" let synname = ""
if cline !~ '<?.*?>' if cline !~ '<?.*?>'
@@ -447,8 +457,7 @@ function! GetPhpIndent()
if synname!="" if synname!=""
if synname == "SpecStringEntrails" if synname == "SpecStringEntrails"
let b:InPHPcode = -1 " thumb down let b:InPHPcode = -1
let b:UserIsTypingComment = 0
let b:InPHPcode_tofind = "" let b:InPHPcode_tofind = ""
elseif synname != "phpHereDoc" && synname != "phpHereDocDelimiter" elseif synname != "phpHereDoc" && synname != "phpHereDocDelimiter"
let b:InPHPcode = 1 let b:InPHPcode = 1
@@ -456,8 +465,7 @@ function! GetPhpIndent()
if synname =~# '^php\%(Doc\)\?Comment' if synname =~# '^php\%(Doc\)\?Comment'
let b:UserIsTypingComment = 1 let b:UserIsTypingComment = 1
else let b:InPHPcode_checked = 0
let b:UserIsTypingComment = 0
endif endif
if synname =~? '^javaScript' if synname =~? '^javaScript'
@@ -466,18 +474,16 @@ function! GetPhpIndent()
else else
let b:InPHPcode = 0 let b:InPHPcode = 0
let b:UserIsTypingComment = 0
let lnum = v:lnum - 1 let lnum = v:lnum - 1
while getline(lnum) !~? '<<<''\=\a\w*''\=$' && lnum > 1 while getline(lnum) !~? '<<<\s*[''"]\=\a\w*[''"]\=$' && lnum > 1
let lnum = lnum - 1 let lnum = lnum - 1
endwhile endwhile
let b:InPHPcode_tofind = substitute( getline(lnum), '^.*<<<''\=\(\a\w*\)''\=$', '^\\s*\1;\\=$', '') let b:InPHPcode_tofind = substitute( getline(lnum), '^.*<<<\s*[''"]\=\(\a\w*\)[''"]\=$', '^\\s*\1;\\=$', '')
endif endif
else else
let b:InPHPcode = 0 let b:InPHPcode = 0
let b:UserIsTypingComment = 0
let b:InPHPcode_tofind = s:PHP_startindenttag let b:InPHPcode_tofind = s:PHP_startindenttag
endif endif
endif "!b:InPHPcode_checked }}} endif "!b:InPHPcode_checked }}}
@@ -537,9 +543,9 @@ function! GetPhpIndent()
elseif last_line =~ '^[^''"`]\+[''"`]$' elseif last_line =~ '^[^''"`]\+[''"`]$'
let b:InPHPcode = -1 let b:InPHPcode = -1
let b:InPHPcode_tofind = substitute( last_line, '^.*\([''"`]\).*$', '^[^\1]*\1[;,]$', '') let b:InPHPcode_tofind = substitute( last_line, '^.*\([''"`]\).*$', '^[^\1]*\1[;,]$', '')
elseif last_line =~? '<<<''\=\a\w*''\=$' elseif last_line =~? '<<<\s*[''"]\=\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, '^.*<<<\s*[''"]\=\(\a\w*\)[''"]\=$', '^\\s*\1;\\=$', '')
elseif !UserIsEditing && cline =~ '^\s*/\*\%(.*\*/\)\@!' && getline(v:lnum + 1) !~ '^\s*\*' elseif !UserIsEditing && cline =~ '^\s*/\*\%(.*\*/\)\@!' && getline(v:lnum + 1) !~ '^\s*\*'
let b:InPHPcode = 0 let b:InPHPcode = 0
@@ -660,7 +666,7 @@ function! GetPhpIndent()
let b:PHP_CurrentIndentLevel = b:PHP_default_indenting let b:PHP_CurrentIndentLevel = b:PHP_default_indenting
return indent(FindTheIfOfAnElse(v:lnum, 1)) return indent(FindTheIfOfAnElse(v:lnum, 1))
elseif cline =~# s:defaultORcase elseif cline =~# s:defaultORcase
return FindTheSwitchIndent(v:lnum) + &sw * b:PHP_vintage_case_default_indent return FindTheSwitchIndent(v:lnum) + s:sw() * b:PHP_vintage_case_default_indent
elseif cline =~ '^\s*)\=\s*{' elseif cline =~ '^\s*)\=\s*{'
let previous_line = last_line let previous_line = last_line
let last_line_num = lnum let last_line_num = lnum
@@ -672,7 +678,7 @@ function! GetPhpIndent()
let ind = indent(last_line_num) let ind = indent(last_line_num)
if b:PHP_BracesAtCodeLevel if b:PHP_BracesAtCodeLevel
let ind = ind + &sw let ind = ind + s:sw()
endif endif
return ind return ind
@@ -683,7 +689,7 @@ function! GetPhpIndent()
endwhile endwhile
elseif last_line =~# unstated && cline !~ '^\s*);\='.endline elseif last_line =~# unstated && cline !~ '^\s*);\='.endline
let ind = ind + &sw let ind = ind + s:sw()
return ind + addSpecial return ind + addSpecial
elseif (ind != b:PHP_default_indenting || last_line =~ '^[)\]]' ) && last_line =~ terminated elseif (ind != b:PHP_default_indenting || last_line =~ '^[)\]]' ) && last_line =~ terminated
@@ -782,7 +788,7 @@ function! GetPhpIndent()
endif endif
if !dontIndent && (!b:PHP_BracesAtCodeLevel || last_line !~# '^\s*{') if !dontIndent && (!b:PHP_BracesAtCodeLevel || last_line !~# '^\s*{')
let ind = ind + &sw let ind = ind + s:sw()
endif endif
if b:PHP_BracesAtCodeLevel || b:PHP_vintage_case_default_indent == 1 if b:PHP_BracesAtCodeLevel || b:PHP_vintage_case_default_indent == 1
@@ -800,17 +806,17 @@ function! GetPhpIndent()
endif endif
elseif last_line =~ '^\s*'.s:blockstart elseif last_line =~ '^\s*'.s:blockstart
let ind = ind + &sw let ind = ind + s:sw()
elseif AntepenultimateLine =~ '{'.endline || AntepenultimateLine =~ terminated || AntepenultimateLine =~# s:defaultORcase elseif AntepenultimateLine =~ '{'.endline || AntepenultimateLine =~ terminated || AntepenultimateLine =~# s:defaultORcase
let ind = ind + &sw let ind = ind + s:sw()
endif endif
endif endif
if cline =~ '^\s*[)\]];\=' if cline =~ '^\s*[)\]];\='
let ind = ind - &sw let ind = ind - s:sw()
endif endif
let b:PHP_CurrentIndentLevel = ind let b:PHP_CurrentIndentLevel = ind