aboutsummaryrefslogtreecommitdiff
path: root/vim/after/ftplugin/php.vim
diff options
context:
space:
mode:
Diffstat (limited to 'vim/after/ftplugin/php.vim')
-rw-r--r--vim/after/ftplugin/php.vim20
1 files changed, 18 insertions, 2 deletions
diff --git a/vim/after/ftplugin/php.vim b/vim/after/ftplugin/php.vim
index 58d83c49..b747a14e 100644
--- a/vim/after/ftplugin/php.vim
+++ b/vim/after/ftplugin/php.vim
@@ -2,12 +2,20 @@
compiler php
let b:undo_ftplugin .= '|unlet b:current_compiler'
\ . '|setlocal errorformat< makeprg<'
+if executable('php-cs-fixer')
+ setlocal equalprg=phpcsff
+ let b:undo_ftplugin .= '|setlocal equalprg<'
+endif
" Set comment formats
setlocal comments=s1:/*,m:*,ex:*/,://,:#
setlocal formatoptions+=or
let b:undo_ftplugin .= '|setlocal comments< formatoptions<'
+" Fold based on indent level
+setlocal foldmethod=indent
+let b:undo_ftplugin .= '|setlocal foldmethod<'
+
" Use pman as 'keywordprg'
setlocal keywordprg=pman
let b:undo_ftplugin .= '|setlocal keywordprg<'
@@ -16,12 +24,20 @@ let b:undo_ftplugin .= '|setlocal keywordprg<'
let b:regex_escape_flavor = 'ere'
let b:undo_ftplugin .= '|unlet b:regex_escape_flavor'
+" Set HTML as an alternative filetype
+if !exists('b:alternate_filetypes')
+ let b:alternate_filetypes = [&filetype, 'html']
+endif
+
" Stop here if the user doesn't want ftplugin mappings
if exists('no_plugin_maps') || exists('no_php_maps')
finish
endif
-" Switch to HTML filetype for templated PHP
+" Mappings to choose 'equalprg'
nnoremap <buffer> <LocalLeader>f
- \ :<C-U>setlocal filetype=html<CR>
+ \ :<C-U>setlocal equalprg=phpcsff<CR>
+nnoremap <buffer> <LocalLeader>i
+ \ :<C-U>setlocal equalprg<<CR>
let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>f'
+ \ . '|nunmap <buffer> <LocalLeader>i'