From 36c08e5bf9eb50a1276ce90ba1c098920f503c7f Mon Sep 17 00:00:00 2001 From: Benjamin Pearson Date: Mon, 28 Apr 2014 10:26:30 +1000 Subject: [PATCH 1/3] 1. Fixing variables to check the value not if it exists. --- syntax/php.vim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/syntax/php.vim b/syntax/php.vim index f503493..6781e96 100644 --- a/syntax/php.vim +++ b/syntax/php.vim @@ -2,7 +2,7 @@ " Language: PHP 5.3 & up " Maintainer: Paul Garvin " Last Change: April 2, 2010 -" URL: +" URL: " " Former Maintainer: Peter Hodge " Former URL: http://www.vim.org/scripts/script.php?script_id=1571 @@ -65,7 +65,7 @@ unlet! b:current_syntax syntax spell default " Set sync method if none declared -if !exists("php_sync_method") +if (!exists("php_sync_method") || php_sync_method==1) if exists("php_minlines") let php_sync_method=php_minlines else @@ -80,16 +80,16 @@ syn sync clear unlet! b:current_syntax syn cluster sqlTop remove=sqlString,sqlComment -if exists("php_sql_query") +if (!exists("php_sql_query") || php_sql_query==1) syn cluster phpAddStrings contains=@sqlTop endif -if exists("php_html_in_strings") +if (!exists("php_html_in_strings") || php_html_in_strings==1) syn cluster phpAddStrings add=@htmlTop endif syn case match - + " Superglobals syn keyword phpSuperglobals GLOBALS _GET _POST _REQUEST _FILES _COOKIE _SERVER _SESSION _ENV HTTP_RAW_POST_DATA php_errormsg http_response_header argc argv contained From c4bee1d30bfff4d7af714213f1ce5c27c58732c2 Mon Sep 17 00:00:00 2001 From: Benjamin Pearson Date: Mon, 28 Apr 2014 10:31:55 +1000 Subject: [PATCH 2/3] 1. Fixing the variable name. --- ftplugin/php.vim | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ftplugin/php.vim b/ftplugin/php.vim index 9b59f84..2a08e3c 100644 --- a/ftplugin/php.vim +++ b/ftplugin/php.vim @@ -1,12 +1,12 @@ " File: php.vim " Description: PHP Integration for VIM plugin -" This file is a considerable fork of the original +" This file is a considerable fork of the original " PDV written by Tobias Schlitt . " Maintainer: Steve Francia " Version: 0.9 " Last Change: 7th January 2012 -" -" +" +" " Section: script init stuff {{{1 if exists("loaded_piv") finish @@ -36,8 +36,8 @@ endfunction " {{{ Settings " First the global PHP configuration let php_sql_query=1 " to highlight SQL syntax in strings -let php_htmlInStrings=1 " to highlight HTML in string -let php_noShortTags = 1 " to disable short tags +let php_html_in_strings=1 " to highlight HTML in string +let php_noShortTags = 1 " to disable short tags let PHP_autoformatcomment = 1 let php_sync_method = -1 if (!exists('php_folding')) @@ -152,15 +152,15 @@ func! PhpAlign() range continue endif " \{-\} matches ungreed * - let l:index = substitute (getline (l:line), '^\s*\(.\{-\}\)\s*\S\{0,1}=\S\{0,1\}\s.*$', '\1', "") + let l:index = substitute (getline (l:line), '^\s*\(.\{-\}\)\s*\S\{0,1}=\S\{0,1\}\s.*$', '\1', "") let l:indexlength = strlen (l:index) let l:maxlength = l:indexlength > l:maxlength ? l:indexlength : l:maxlength let l:line = l:line + 1 endwhile - + let l:line = a:firstline let l:format = "%s%-" . l:maxlength . "s %s %s" - + while l:line <= l:endline if getline (l:line) =~ '^\s*\/\/.*$' let l:line = l:line + 1 @@ -178,7 +178,7 @@ func! PhpAlign() range let &g:paste = l:paste endfunc -" }}} +" }}} function! s:CreateNMap(target, combo) if !hasmapto(a:target, 'n') From 97fa87ed90ec5071a6b0c2e0524fdaf4f1ab6df1 Mon Sep 17 00:00:00 2001 From: Benjamin Pearson Date: Mon, 28 Apr 2014 10:39:38 +1000 Subject: [PATCH 3/3] 1. Do not overwrite variables if already defined. --- ftplugin/php.vim | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/ftplugin/php.vim b/ftplugin/php.vim index 2a08e3c..86a4d5a 100644 --- a/ftplugin/php.vim +++ b/ftplugin/php.vim @@ -35,11 +35,21 @@ endfunction " {{{ Settings " First the global PHP configuration -let php_sql_query=1 " to highlight SQL syntax in strings -let php_html_in_strings=1 " to highlight HTML in string -let php_noShortTags = 1 " to disable short tags -let PHP_autoformatcomment = 1 -let php_sync_method = -1 +if (!exists('php_sql_query')) + let php_sql_query=1 " to highlight SQL syntax in strings +endif +if (!exists('php_html_in_strings')) + let php_html_in_strings=1 " to highlight HTML in string +endif +if (!exists('php_noShortTags')) + let php_noShortTags = 1 " to disable short tags +endif +if (!exists('php_autoformatcomment')) + let PHP_autoformatcomment = 1 +endif +if (!exists('php_sync_method')) + let php_sync_method = -1 +endif if (!exists('php_folding')) let php_folding = 1 "to enable folding for classes and functions endif