diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-12-15 17:23:09 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-12-15 17:23:09 +1300 |
commit | aa2032ac9647c10192c73b66d748735909a8826c (patch) | |
tree | 549da9c8f7549c88688120afab3ad543d4fe138d /vim/after/ftplugin/php.vim | |
parent | Merge branch 'release/v8.3.0' (diff) | |
parent | Bump VERSION (diff) | |
download | dotfiles-aa2032ac9647c10192c73b66d748735909a8826c.tar.gz dotfiles-aa2032ac9647c10192c73b66d748735909a8826c.zip |
Merge branch 'release/v8.4.0'v8.4.0
* release/v8.4.0:
Add mappings to change 'equalprg' in Perl and PHP
Diffstat (limited to 'vim/after/ftplugin/php.vim')
-rw-r--r-- | vim/after/ftplugin/php.vim | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/vim/after/ftplugin/php.vim b/vim/after/ftplugin/php.vim index 0ce099a0..20d8d42e 100644 --- a/vim/after/ftplugin/php.vim +++ b/vim/after/ftplugin/php.vim @@ -1,8 +1,11 @@ " Use PHP itself for syntax checking compiler php -setlocal equalprg=phpcsff let b:undo_ftplugin .= '|unlet b:current_compiler' - \ . '|setlocal equalprg< errorformat< makeprg<' + \ . '|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:*/,://,:# @@ -26,3 +29,16 @@ let b:undo_ftplugin .= '|unlet b:regex_escape_flavor' 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 + +" Mappings to choose 'equalprg' +nnoremap <buffer> <LocalLeader>f + \ :<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' |