160b92eedc0795344877fe77ad5b9297584018b2
Author: AD7six
Date: 2009-12-04 22:31:18 +0100
diff --git a/vendors/vim/plugins/cakephp.vim b/vendors/vim/plugins/cakephp.vim
index d2d361c..bd87ba9 100644
--- a/vendors/vim/plugins/cakephp.vim
+++ b/vendors/vim/plugins/cakephp.vim
@@ -155,6 +155,11 @@ endfunc
" Function: BufferWritePre()
" EOL markers are not desired, change to binary mode before saving so one isn't added
function s:BufferWritePre()
+ "remove trailing whitespace
+ :silent %s/\s\s*$//e
+ "remove trailing windoze
+ :silent %s/
$//e
+
" set to binary and remove eol
let b:save_bin = &bin
let &l:bin = 1
@@ -209,10 +214,10 @@ function s:SetupBuffer()
endif
"autocmd BufWinEnter * :let w:m1=matchadd('Search', '\%<101v.\%>97v', -1)
"autocmd BufWinEnter * :let w:m2=matchadd('ErrorMsg', '\%>100v.\+', -1)
- autocmd BufNewFile * call s:SetupBuffer()
- autocmd BufReadPost * call s:SetupBuffer()
- autocmd BufWritePre * call s:BufferWritePre()
- autocmd BufWritePost * call s:BufferWritePost()
+ autocmd BufNewFile *.{php,ctp,css,js} call s:SetupBuffer()
+ autocmd BufReadPost *.{php,ctp,css,js} call s:SetupBuffer()
+ autocmd BufWritePre *.{php,ctp,css,js} call s:BufferWritePre()
+ autocmd BufWritePost *.{php,ctp,css,js} call s:BufferWritePost()
call s:SetupCommands()
call s:SetupMappings()
call s:SetupMenu()
@@ -276,6 +281,9 @@ function FormatPhp() range
":silent '<,'>s/ \{2,}/ /ge
"remove trailing whitespace
:silent 'y,'zs/\s\s*$//e
+ "remove trailing windoze
+ :silent 'y,'zs/
$//e
+
" Lower case booleans please
:silent 'y,'zs/TRUE/true/e
:silent 'y,'zs/FALSE/false/e
@@ -311,7 +319,6 @@ function FormatPhp() range
" auto correct deprecated methods
:silent 'y,'zs/\W\zsam(/array_merge(/e
-
'y,'z:call s:FormatComments()
" indent
@@ -634,4 +641,4 @@ endfunction
function s:DeleteBlankLines()
" :g/^\s\*$/d
exe "norm :g/^\s\*$/d<CR>"
-endfunction
\ No newline at end of file
+endfunction
