mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
More updated runtime files.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
*indent.txt* For Vim version 7.3c. Last change: 2010 Mar 27
|
*indent.txt* For Vim version 7.3c. Last change: 2010 Jul 30
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@@ -549,7 +549,7 @@ those useless characters first with a command like: >
|
|||||||
:%s /\r$//g
|
:%s /\r$//g
|
||||||
|
|
||||||
Or, you can simply |:let| the variable PHP_removeCRwhenUnix to 1 and the
|
Or, you can simply |:let| the variable PHP_removeCRwhenUnix to 1 and the
|
||||||
script will silently remove them when Vim loads a PHP file (at each |BufRead|).
|
script will silently remove them when Vim loads a PHP file (at each|BufRead|).
|
||||||
|
|
||||||
OPTIONS: ~
|
OPTIONS: ~
|
||||||
|
|
||||||
@@ -557,7 +557,7 @@ PHP indenting can be altered in several ways by modifying the values of some
|
|||||||
variables:
|
variables:
|
||||||
|
|
||||||
*php-comment*
|
*php-comment*
|
||||||
To not enable auto-formatting 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
|
||||||
|
|
||||||
@@ -584,6 +584,10 @@ For example, with N = 1, this will give:
|
|||||||
(Notice the extra indent between the PHP container markers and the code)
|
(Notice the extra indent between the PHP container markers and the code)
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
To indent PHP tags as the surrounding code: >
|
||||||
|
:let g:PHP_outdentphpescape = 0
|
||||||
|
-------------
|
||||||
|
|
||||||
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
|
||||||
-------------
|
-------------
|
||||||
@@ -609,7 +613,7 @@ NOTE: Indenting will be a bit slower if this option is used because some
|
|||||||
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
|
||||||
|
|
||||||
(By default they are indented at the same level than the 'switch()' to avoid
|
(Since in PHP braces are not required inside 'case/default' blocks, by default they are indented at the same level than the 'switch()' to avoid
|
||||||
unnecessary indentation)
|
unnecessary indentation)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -77,6 +77,9 @@ Results in E670. (Tony Mechelynck, 2010 May 2)
|
|||||||
":helpgrep" does not put the cursor in the correct column when preceded by
|
":helpgrep" does not put the cursor in the correct column when preceded by
|
||||||
accented character. (Tony Mechelynck, 2010 Apr 15)
|
accented character. (Tony Mechelynck, 2010 Apr 15)
|
||||||
|
|
||||||
|
Patch: Let rare word highlighting overrule good word highlighting.
|
||||||
|
(Jakson A. Aquino, 2010 Jul 30)
|
||||||
|
|
||||||
Better Czech keymap. (Stepnem, 2010 May 4) Use if no response from Jiri
|
Better Czech keymap. (Stepnem, 2010 May 4) Use if no response from Jiri
|
||||||
Tobisek.
|
Tobisek.
|
||||||
|
|
||||||
|
@@ -2,12 +2,13 @@
|
|||||||
" Language: PHP
|
" Language: PHP
|
||||||
" 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
|
||||||
" Last Change: 2008 November 22nd
|
" Last Change: 2010 Jully 26th
|
||||||
" Newsletter: http://www.2072productions.com/?to=php-indent-for-vim-newsletter.php
|
" Newsletter: http://www.2072productions.com/?to=php-indent-for-vim-newsletter.php
|
||||||
" Version: 1.30
|
" Version: 1.33
|
||||||
"
|
"
|
||||||
"
|
"
|
||||||
" If you find a bug, please e-mail me at John.wellesz (AT) teaser (DOT) fr
|
" If you find a bug, please report it on GitHub:
|
||||||
|
" http://github.com/2072/PHP-Indenting-for-VIm/issues
|
||||||
" with an example of code that breaks the algorithm.
|
" with an example of code that breaks the algorithm.
|
||||||
"
|
"
|
||||||
"
|
"
|
||||||
@@ -15,7 +16,7 @@
|
|||||||
"
|
"
|
||||||
"
|
"
|
||||||
" NOTE: This script must be used with PHP syntax ON and with the php syntax
|
" NOTE: This script must be used with PHP syntax ON and with the php syntax
|
||||||
" script by Lutz Eymers (http://www.isp.de/data/php.vim ) or with the
|
" script by Lutz Eymers (http://www.ipdienste.net/data/php.vim ) or with the
|
||||||
" script by Peter Hodge (http://www.vim.org/scripts/script.php?script_id=1571 )
|
" script by Peter Hodge (http://www.vim.org/scripts/script.php?script_id=1571 )
|
||||||
" the later is bunbdled by default with Vim 7.
|
" the later is bunbdled by default with Vim 7.
|
||||||
"
|
"
|
||||||
@@ -68,8 +69,15 @@ else
|
|||||||
let b:PHP_autoformatcomment = 1
|
let b:PHP_autoformatcomment = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if exists("PHP_vintage_case_default_indent")
|
if exists("PHP_outdentphpescape")
|
||||||
let b:PHP_vintage_case_default_indent = PHP_vintage_case_default_indent
|
let b:PHP_outdentphpescape = PHP_outdentphpescape
|
||||||
|
else
|
||||||
|
let b:PHP_outdentphpescape = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
if exists("PHP_vintage_case_default_indent") && PHP_vintage_case_default_indent
|
||||||
|
let b:PHP_vintage_case_default_indent = 1
|
||||||
else
|
else
|
||||||
let b:PHP_vintage_case_default_indent = 0
|
let b:PHP_vintage_case_default_indent = 0
|
||||||
endif
|
endif
|
||||||
@@ -108,12 +116,11 @@ endif
|
|||||||
|
|
||||||
if exists("*GetPhpIndent")
|
if exists("*GetPhpIndent")
|
||||||
call ResetPhpOptions()
|
call ResetPhpOptions()
|
||||||
finish " XXX
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let s:endline= '\s*\%(//.*\|#.*\|/\*.*\*/\s*\)\=$'
|
let s:endline= '\s*\%(//.*\|#.*\|/\*.*\*/\s*\)\=$'
|
||||||
let s:PHP_startindenttag = '<?\%(.*?>\)\@!\|<script[^>]*>\%(.*<\/script>\)\@!'
|
let s:PHP_startindenttag = '<?\%(.*?>\)\@!\|<script[^>]*>\%(.*<\/script>\)\@!'
|
||||||
"setlocal debug=msg " XXX
|
|
||||||
|
|
||||||
|
|
||||||
function! GetLastRealCodeLNum(startline) " {{{
|
function! GetLastRealCodeLNum(startline) " {{{
|
||||||
@@ -164,8 +171,8 @@ function! GetLastRealCodeLNum(startline) " {{{
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
elseif lastline =~? '^\a\w*;\=$' && lastline !~? s:notPhpHereDoc " XXX 0607
|
elseif lastline =~? '^\a\w*;\=$' && lastline !~? s:notPhpHereDoc
|
||||||
let tofind=substitute( lastline, '\(\a\w*\);\=', '<<<''\\=\1''\\=$', '') " XXX 0607
|
let tofind=substitute( lastline, '\(\a\w*\);\=', '<<<''\\=\1''\\=$', '')
|
||||||
while getline(lnum) !~? tofind && lnum > 1
|
while getline(lnum) !~? tofind && lnum > 1
|
||||||
let lnum = lnum - 1
|
let lnum = lnum - 1
|
||||||
endwhile
|
endwhile
|
||||||
@@ -174,7 +181,7 @@ function! GetLastRealCodeLNum(startline) " {{{
|
|||||||
endif
|
endif
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
if lnum==1 && getline(lnum)!~ '<?'
|
if lnum==1 && getline(lnum) !~ '<?'
|
||||||
let lnum=0
|
let lnum=0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -198,7 +205,7 @@ function! Skippmatch2()
|
|||||||
endif
|
endif
|
||||||
endfun
|
endfun
|
||||||
|
|
||||||
function! Skippmatch() " {{{
|
function! Skippmatch() " {{{
|
||||||
let synname = synIDattr(synID(line("."), col("."), 0), "name")
|
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 =~# "^phpComment" && b:UserIsTypingComment
|
||||||
return 0
|
return 0
|
||||||
@@ -243,7 +250,7 @@ function! FindTheIfOfAnElse (lnum, StopAfterFirstPrevElse) " {{{
|
|||||||
|
|
||||||
if getline(beforeelse) !~# '^\s*if\>' && beforeelse>1 || s:iftoskip && beforeelse>1
|
if getline(beforeelse) !~# '^\s*if\>' && beforeelse>1 || s:iftoskip && beforeelse>1
|
||||||
|
|
||||||
if s:iftoskip && getline(beforeelse) =~# '^\s*if\>'
|
if s:iftoskip && getline(beforeelse) =~# '^\s*if\>'
|
||||||
let s:iftoskip = s:iftoskip - 1
|
let s:iftoskip = s:iftoskip - 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -255,6 +262,36 @@ function! FindTheIfOfAnElse (lnum, StopAfterFirstPrevElse) " {{{
|
|||||||
|
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
|
let s:defaultORcase = '^\s*\%(default\|case\).*:'
|
||||||
|
|
||||||
|
function! FindTheSwitchIndent (lnum) " {{{
|
||||||
|
|
||||||
|
|
||||||
|
let test = GetLastRealCodeLNum(a:lnum - 1)
|
||||||
|
|
||||||
|
if test <= 1
|
||||||
|
return indent(1) - &sw * b:PHP_vintage_case_default_indent
|
||||||
|
end
|
||||||
|
|
||||||
|
if getline(test) =~ '^\s*}'
|
||||||
|
let test = FindOpenBracket(test)
|
||||||
|
|
||||||
|
if getline(test) =~ '^\s*{'
|
||||||
|
let test = GetLastRealCodeLNum(GetLastRealCodeLNum(test - 1) - 1)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
if getline(test) =~# '^\s*switch\>'
|
||||||
|
return indent(test)
|
||||||
|
elseif getline(test) =~# s:defaultORcase
|
||||||
|
return indent(test) - &sw * b:PHP_vintage_case_default_indent
|
||||||
|
else
|
||||||
|
return FindTheSwitchIndent(test)
|
||||||
|
endif
|
||||||
|
|
||||||
|
endfunction "}}}
|
||||||
|
|
||||||
|
|
||||||
function! IslinePHP (lnum, tofind) " {{{
|
function! IslinePHP (lnum, tofind) " {{{
|
||||||
let cline = getline(a:lnum)
|
let cline = getline(a:lnum)
|
||||||
|
|
||||||
@@ -278,7 +315,7 @@ function! IslinePHP (lnum, tofind) " {{{
|
|||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
let s:notPhpHereDoc = '\%(break\|return\|continue\|exit\|else\)'
|
let s:notPhpHereDoc = '\%(break\|return\|continue\|exit\|else\)'
|
||||||
let s:blockstart = '\%(\%(\%(}\s*\)\=else\%(\s\+\)\=\)\=if\>\|else\>\|while\>\|switch\>\|for\%(each\)\=\>\|declare\>\|class\>\|interface\>\|abstract\>\|try\>\|catch\>\)'
|
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
|
||||||
@@ -286,7 +323,7 @@ if ! s:autoresetoptions
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
function! ResetPhpOptions()
|
function! ResetPhpOptions()
|
||||||
if ! b:optionsset && &filetype == "php"
|
if ! b:optionsset && &filetype == "php"
|
||||||
if b:PHP_autoformatcomment
|
if b:PHP_autoformatcomment
|
||||||
|
|
||||||
setlocal comments=s1:/*,mb:*,ex:*/,://,:#
|
setlocal comments=s1:/*,mb:*,ex:*/,://,:#
|
||||||
@@ -324,7 +361,7 @@ function! GetPhpIndent()
|
|||||||
if !b:PHP_indentinghuge && b:PHP_lastindented > b:PHP_indentbeforelast
|
if !b:PHP_indentinghuge && b:PHP_lastindented > b:PHP_indentbeforelast
|
||||||
if b:PHP_indentbeforelast
|
if b:PHP_indentbeforelast
|
||||||
let b:PHP_indentinghuge = 1
|
let b:PHP_indentinghuge = 1
|
||||||
echom 'Large indenting detected, speed optimizations engaged (v1.30)'
|
echom 'Large indenting detected, speed optimizations engaged (v1.33)'
|
||||||
endif
|
endif
|
||||||
let b:PHP_indentbeforelast = b:PHP_lastindented
|
let b:PHP_indentbeforelast = b:PHP_lastindented
|
||||||
endif
|
endif
|
||||||
@@ -383,7 +420,7 @@ function! GetPhpIndent()
|
|||||||
let lnum = lnum - 1
|
let lnum = lnum - 1
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
let b:InPHPcode_tofind = substitute( getline(lnum), '^.*<<<''\=\(\a\w*\)''\=$', '^\\s*\1;\\=$', '') " XXX 0607
|
let b:InPHPcode_tofind = substitute( getline(lnum), '^.*<<<''\=\(\a\w*\)''\=$', '^\\s*\1;\\=$', '')
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let b:InPHPcode = 0
|
let b:InPHPcode = 0
|
||||||
@@ -399,7 +436,7 @@ function! GetPhpIndent()
|
|||||||
|
|
||||||
if b:InPHPcode_tofind!=""
|
if b:InPHPcode_tofind!=""
|
||||||
if cline =~? b:InPHPcode_tofind
|
if cline =~? b:InPHPcode_tofind
|
||||||
let b:InPHPcode = 1
|
let b:InPHPcode = 1
|
||||||
let b:InPHPcode_tofind = ""
|
let b:InPHPcode_tofind = ""
|
||||||
let b:UserIsTypingComment = 0
|
let b:UserIsTypingComment = 0
|
||||||
if cline =~ '\*/'
|
if cline =~ '\*/'
|
||||||
@@ -436,9 +473,9 @@ function! GetPhpIndent()
|
|||||||
let b:InPHPcode_and_script = 1
|
let b:InPHPcode_and_script = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
elseif last_line =~? '<<<''\=\a\w*''\=$' " XXX 0607
|
elseif last_line =~? '<<<''\=\a\w*''\=$'
|
||||||
let b:InPHPcode = 0
|
let b:InPHPcode = 0
|
||||||
let b:InPHPcode_tofind = substitute( last_line, '^.*<<<''\=\(\a\w*\)''\=$', '^\\s*\1;\\=$', '') " XXX 0607
|
let b:InPHPcode_tofind = substitute( last_line, '^.*<<<''\=\(\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
|
||||||
@@ -488,15 +525,15 @@ function! GetPhpIndent()
|
|||||||
|
|
||||||
|
|
||||||
" Things always indented at col 1 (PHP delimiter: <?, ?>, Heredoc end) {{{
|
" Things always indented at col 1 (PHP delimiter: <?, ?>, Heredoc end) {{{
|
||||||
if cline =~# '^\s*<?' && cline !~ '?>'
|
if cline =~# '^\s*<?' && cline !~ '?>' && b:PHP_outdentphpescape
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if cline =~ '^\s*?>' && cline !~# '<?'
|
if cline =~ '^\s*?>' && cline !~# '<?' && b:PHP_outdentphpescape
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if cline =~? '^\s*\a\w*;$\|^\a\w*$' && cline !~? s:notPhpHereDoc " XXX 0607
|
if cline =~? '^\s*\a\w*;$\|^\a\w*$' && cline !~? s:notPhpHereDoc
|
||||||
return 0
|
return 0
|
||||||
endif " }}}
|
endif " }}}
|
||||||
|
|
||||||
@@ -539,9 +576,8 @@ function! GetPhpIndent()
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let defaultORcase = '^\s*\%(default\|case\).*:'
|
|
||||||
|
|
||||||
if last_line =~ '[;}]'.endline && last_line !~ '^)' && last_line !~# defaultORcase " Added && last_line !~ '^)' on 2007-12-30
|
if last_line =~ '[;}]'.endline && last_line !~ '^)' && last_line !~# s:defaultORcase
|
||||||
if ind==b:PHP_default_indenting
|
if ind==b:PHP_default_indenting
|
||||||
return b:PHP_default_indenting
|
return b:PHP_default_indenting
|
||||||
elseif b:PHP_indentinghuge && ind==b:PHP_CurrentIndentLevel && cline !~# '^\s*\%(else\|\%(case\|default\).*:\|[})];\=\)' && last_line !~# '^\s*\%(\%(}\s*\)\=else\)' && getline(GetLastRealCodeLNum(lnum - 1))=~';'.endline
|
elseif b:PHP_indentinghuge && ind==b:PHP_CurrentIndentLevel && cline !~# '^\s*\%(else\|\%(case\|default\).*:\|[})];\=\)' && last_line !~# '^\s*\%(\%(}\s*\)\=else\)' && getline(GetLastRealCodeLNum(lnum - 1))=~';'.endline
|
||||||
@@ -551,13 +587,15 @@ function! GetPhpIndent()
|
|||||||
|
|
||||||
let LastLineClosed = 0
|
let LastLineClosed = 0
|
||||||
|
|
||||||
let terminated = '\%(;\%(\s*?>\)\=\|<<<''\=\a\w*''\=$\|^\s*}\)'.endline " XXX 0607
|
let terminated = '\%(;\%(\s*?>\)\=\|<<<''\=\a\w*''\=$\|^\s*}\)'.endline
|
||||||
|
|
||||||
let unstated = '\%(^\s*'.s:blockstart.'.*)\|\%(//.*\)\@<!\<e'.'lse\>\)'.endline
|
let unstated = '\%(^\s*'.s:blockstart.'.*)\|\%(//.*\)\@<!\<e'.'lse\>\)'.endline
|
||||||
|
|
||||||
if ind != b:PHP_default_indenting && cline =~# '^\s*else\%(if\)\=\>'
|
if ind != b:PHP_default_indenting && cline =~# '^\s*else\%(if\)\=\>'
|
||||||
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
|
||||||
|
return FindTheSwitchIndent(v:lnum) + &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
|
||||||
@@ -580,10 +618,10 @@ function! GetPhpIndent()
|
|||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
elseif last_line =~# unstated && cline !~ '^\s*);\='.endline
|
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
|
return ind
|
||||||
|
|
||||||
elseif (ind != b:PHP_default_indenting || last_line =~ '^)' ) && last_line =~ terminated " Added || last_line =~ '^)' on 2007-12-30 (array indenting [rpblem broke other things)
|
elseif (ind != b:PHP_default_indenting || last_line =~ '^)' ) && last_line =~ terminated
|
||||||
let previous_line = last_line
|
let previous_line = last_line
|
||||||
let last_line_num = lnum
|
let last_line_num = lnum
|
||||||
let LastLineClosed = 1
|
let LastLineClosed = 1
|
||||||
@@ -616,7 +654,7 @@ function! GetPhpIndent()
|
|||||||
let previous_line = getline(last_line_num)
|
let previous_line = getline(last_line_num)
|
||||||
|
|
||||||
|
|
||||||
if previous_line =~# defaultORcase.'\|{'.endline
|
if previous_line =~# s:defaultORcase.'\|{'.endline
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -636,15 +674,12 @@ function! GetPhpIndent()
|
|||||||
let ind = indent(last_match)
|
let ind = indent(last_match)
|
||||||
let b:PHP_CurrentIndentLevel = b:PHP_default_indenting
|
let b:PHP_CurrentIndentLevel = b:PHP_default_indenting
|
||||||
|
|
||||||
if cline =~# defaultORcase
|
|
||||||
let ind = ind - &sw
|
|
||||||
endif
|
|
||||||
return ind
|
return ind
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let plinnum = GetLastRealCodeLNum(lnum - 1)
|
let plinnum = GetLastRealCodeLNum(lnum - 1)
|
||||||
let pline = getline(plinnum)
|
let AntepenultimateLine = getline(plinnum)
|
||||||
|
|
||||||
let last_line = substitute(last_line,"\\(//\\|#\\)\\(\\(\\([^\"']*\\([\"']\\)[^\"']*\\5\\)\\+[^\"']*$\\)\\|\\([^\"']*$\\)\\)",'','')
|
let last_line = substitute(last_line,"\\(//\\|#\\)\\(\\(\\([^\"']*\\([\"']\\)[^\"']*\\5\\)\\+[^\"']*$\\)\\|\\([^\"']*$\\)\\)",'','')
|
||||||
|
|
||||||
@@ -658,13 +693,13 @@ function! GetPhpIndent()
|
|||||||
if !LastLineClosed
|
if !LastLineClosed
|
||||||
|
|
||||||
|
|
||||||
if last_line =~# '[{(]'.endline || last_line =~? '\h\w*\s*(.*,$' && pline !~ '[,(]'.endline
|
if last_line =~# '[{(]'.endline || last_line =~? '\h\w*\s*(.*,$' && AntepenultimateLine !~ '[,(]'.endline
|
||||||
|
|
||||||
if !b:PHP_BracesAtCodeLevel || last_line !~# '^\s*{'
|
if !b:PHP_BracesAtCodeLevel || last_line !~# '^\s*{'
|
||||||
let ind = ind + &sw
|
let ind = ind + &sw
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if b:PHP_BracesAtCodeLevel || b:PHP_vintage_case_default_indent == 1 || cline !~# defaultORcase
|
if b:PHP_BracesAtCodeLevel || b:PHP_vintage_case_default_indent == 1
|
||||||
let b:PHP_CurrentIndentLevel = ind
|
let b:PHP_CurrentIndentLevel = ind
|
||||||
|
|
||||||
return ind
|
return ind
|
||||||
@@ -677,15 +712,13 @@ function! GetPhpIndent()
|
|||||||
if openedparent != lnum
|
if openedparent != lnum
|
||||||
let ind = indent(openedparent)
|
let ind = indent(openedparent)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
elseif last_line =~ '^\s*'.s:blockstart
|
elseif last_line =~ '^\s*'.s:blockstart
|
||||||
let ind = ind + &sw
|
let ind = ind + &sw
|
||||||
|
|
||||||
elseif last_line =~# defaultORcase && cline !~# defaultORcase
|
|
||||||
let ind = ind + &sw
|
|
||||||
|
|
||||||
|
|
||||||
elseif pline =~ '\%(;\%(\s*?>\)\=\|<<<''\=\a\w*''\=$\|^\s*}\|{\)'.endline . '\|' . defaultORcase && cline !~# defaultORcase
|
elseif AntepenultimateLine =~ '\%(;\%(\s*?>\)\=\|<<<''\=\a\w*''\=$\|^\s*}\|{\)'.endline . '\|' . s:defaultORcase
|
||||||
|
|
||||||
let ind = ind + &sw
|
let ind = ind + &sw
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -693,9 +726,6 @@ function! GetPhpIndent()
|
|||||||
|
|
||||||
if cline =~ '^\s*);\='
|
if cline =~ '^\s*);\='
|
||||||
let ind = ind - &sw
|
let ind = ind - &sw
|
||||||
elseif cline =~# defaultORcase && last_line !~# defaultORcase
|
|
||||||
let ind = ind - &sw
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let b:PHP_CurrentIndentLevel = ind
|
let b:PHP_CurrentIndentLevel = ind
|
||||||
|
Reference in New Issue
Block a user