diff options
author | Bram Moolenaar <Bram@vim.org> | 2004-12-29 20:58:21 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2004-12-29 20:58:21 +0000 |
commit | 81695250ef1bbc02016078044ac268129a33f333 (patch) | |
tree | c31ec7182b5b06ffeb5a14b79701127eaa5c0dc8 /runtime/indent/php.vim | |
parent | 86b68359978c933419279e599d0a8cf536095d77 (diff) | |
download | vim-git-81695250ef1bbc02016078044ac268129a33f333.tar.gz |
updated for version 7.0026
Diffstat (limited to 'runtime/indent/php.vim')
-rw-r--r-- | runtime/indent/php.vim | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/runtime/indent/php.vim b/runtime/indent/php.vim index 208df3ab0..cda861e28 100644 --- a/runtime/indent/php.vim +++ b/runtime/indent/php.vim @@ -3,7 +3,7 @@ " Author: Miles Lott <milos@groupwhere.org> " URL: http://milosch.dyndns.org/php.vim " Last Change: 2004 May 18 -" Version: 0.5 +" Version: 0.4 " Notes: Close all switches with default:\nbreak; and it will look better. " Also, open and close brackets should be alone on a line. " This is my preference, and the only way this will look nice. @@ -11,9 +11,7 @@ " switch/case. It is nearly perfect for anyone regardless of your " stance on brackets. " -" Changes: 0.5 - fix duplicate indent on open tag, and empty bracketed -" statements. -" 0.4 - Fixes for closing php tag, switch statement closure, and php_indent_shortopentags +" Changes: Fixes for closing php tag, switch statement closure, and php_indent_shortopentags " option from Steffen Bruentjen <vim@kontraphon.de> " " Options: php_noindent_switch=1 -- do not try to indent switch/case statements (version 0.1 behavior) @@ -51,16 +49,16 @@ function GetPhpIndent() let pline = getline(lnum - 1) " previous to last line let ind = indent(lnum) - " Indent after php open tag + " Indent after php open tags if line =~ '<?php' let ind = ind + &sw - elseif exists('g:php_indent_shortopentags') - " indent after short open tag + " indent after short open tags + endif + if exists('g:php_indent_shortopentags') if line =~ '<?' let ind = ind + &sw endif endif - " indent after php closing tag if cline =~ '\M?>' let ind = ind - &sw endif @@ -74,17 +72,7 @@ function GetPhpIndent() let ind = ind - &sw endif return ind - else - " Search the matching bracket (with searchpair()) and set the indent of - " to the indent of the matching line. - if cline =~ '^\s*}' - call cursor(line('.'), 1) - let ind = indent(searchpair('{', '', '}', - 'bW', 'synIDattr(synID(line("."), col("."), - 0), "name") =~? "string"')) - return ind - endif - " Try to indent switch/case statements as well + else " Try to indent switch/case statements as well " Indent blocks enclosed by {} or () or case statements, with some anal requirements if line =~ 'case.*:\|[{(]\s*\(#[^)}]*\)\=$' let ind = ind + &sw @@ -104,7 +92,7 @@ function GetPhpIndent() " Search the matching bracket (with searchpair()) and set the indent of cline " to the indent of the matching line. if cline =~ '^\s*}' - call cursor(line('. '), 1) + call cursor(line('.'), 1) let ind = indent(searchpair('{', '', '}', 'bW', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string"')) return ind endif |