This commit is contained in:
committed by
Git OBS Bridge
parent
05f37a24f6
commit
81b8b53252
92
vim-7.2-php.patch
Normal file
92
vim-7.2-php.patch
Normal file
@@ -0,0 +1,92 @@
|
||||
--- runtime/indent/php.vim
|
||||
+++ runtime/indent/php.vim 2009-02-25 16:18:00.411965000 +0100
|
||||
@@ -2,9 +2,9 @@
|
||||
" Language: PHP
|
||||
" Author: John Wellesz <John.wellesz (AT) teaser (DOT) fr>
|
||||
" URL: http://www.2072productions.com/vim/indent/php.vim
|
||||
-" Last Change: 2008 June 7th
|
||||
+" Last Change: 2008 November 22nd
|
||||
" Newsletter: http://www.2072productions.com/?to=php-indent-for-vim-newsletter.php
|
||||
-" Version: 1.28
|
||||
+" Version: 1.30
|
||||
"
|
||||
" If you find a bug, please e-mail me at John.wellesz (AT) teaser (DOT) fr
|
||||
" with an example of code that breaks the algorithm.
|
||||
@@ -24,7 +24,7 @@
|
||||
" 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 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.
|
||||
"
|
||||
"
|
||||
" In the case you have syntax errors in your script such as HereDoc end
|
||||
@@ -75,7 +75,7 @@
|
||||
" some optimizations won't be available.
|
||||
"
|
||||
" Options: PHP_vintage_case_default_indent = 1 (defaults to 0) to add a meaningless indent
|
||||
-" befaore 'case:' and 'default":' statement in switch block
|
||||
+" befaore 'case:' and 'default":' statement in switch blocks.
|
||||
"
|
||||
|
||||
if exists("b:did_indent")
|
||||
@@ -145,6 +145,7 @@ if &fileformat == "unix" && exists("PHP_
|
||||
endif
|
||||
|
||||
if exists("*GetPhpIndent")
|
||||
+ call ResetPhpOptions()
|
||||
finish " XXX
|
||||
endif
|
||||
|
||||
@@ -317,14 +318,13 @@ endfunction " }}}
|
||||
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:autorestoptions = 0
|
||||
-if ! s:autorestoptions
|
||||
- au BufWinEnter,Syntax *.php,*.php3,*.php4,*.php5 call ResetOptions()
|
||||
- let s:autorestoptions = 1
|
||||
+let s:autoresetoptions = 0
|
||||
+if ! s:autoresetoptions
|
||||
+ let s:autoresetoptions = 1
|
||||
endif
|
||||
|
||||
-function! ResetOptions()
|
||||
- if ! b:optionsset
|
||||
+function! ResetPhpOptions()
|
||||
+ if ! b:optionsset && &filetype == "php"
|
||||
if b:PHP_autoformatcomment
|
||||
|
||||
setlocal comments=s1:/*,mb:*,ex:*/,://,:#
|
||||
@@ -341,6 +341,8 @@ function! ResetOptions()
|
||||
endif
|
||||
endfunc
|
||||
|
||||
+call ResetPhpOptions()
|
||||
+
|
||||
function! GetPhpIndent()
|
||||
|
||||
let b:GetLastRealCodeLNum_ADD = 0
|
||||
@@ -360,7 +362,7 @@ function! GetPhpIndent()
|
||||
if !b:PHP_indentinghuge && b:PHP_lastindented > b:PHP_indentbeforelast
|
||||
if b:PHP_indentbeforelast
|
||||
let b:PHP_indentinghuge = 1
|
||||
- echom 'Large indenting detected, speed optimizations engaged (v1.28)'
|
||||
+ echom 'Large indenting detected, speed optimizations engaged (v1.30 BETA 1)'
|
||||
endif
|
||||
let b:PHP_indentbeforelast = b:PHP_lastindented
|
||||
endif
|
||||
@@ -715,11 +717,11 @@ function! GetPhpIndent()
|
||||
elseif last_line =~ '^\s*'.s:blockstart
|
||||
let ind = ind + &sw
|
||||
|
||||
- elseif last_line =~# defaultORcase
|
||||
+ elseif last_line =~# defaultORcase && cline !~# defaultORcase
|
||||
let ind = ind + &sw
|
||||
|
||||
|
||||
- elseif pline =~ '\%(;\%(\s*?>\)\=\|<<<''\=\a\w*''\=$\|^\s*}\|{\)'.endline . '\|' . defaultORcase
|
||||
+ elseif pline =~ '\%(;\%(\s*?>\)\=\|<<<''\=\a\w*''\=$\|^\s*}\|{\)'.endline . '\|' . defaultORcase && cline !~# defaultORcase
|
||||
|
||||
let ind = ind + &sw
|
||||
endif
|
Reference in New Issue
Block a user