Skip to content
This repository has been archived by the owner on Oct 22, 2020. It is now read-only.

nederdirk/vim-phpfmt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

Vim-phpfmt

Inspired by vim-php-cs-fixer. This plugin integrates php.tools.

This plugin will execute the fmt.phar command on the directory or file (depends on which command you call). See options to know how to customize that.

The plugin comes with php.tools fmt.phar embedded, it should suffice.

If you see any improvement or question, please, contribute or create an issue.

Keeping up-to-date:

This plugin updates fmt.phar during VIM opening. If this fails, please open an issue stating what happens and possible logs.

Options available:

let g:phpfmt_on_save = get(g:, 'phpfmt_on_save', 1) " format on save (autocmd)
let g:phpfmt_php_path = "php"               " Path to PHP
"let g:phpfmt_prepasses_list = "AutoPreincrement,JointToImplode"
"let g:phpfmt_passes_list = "ReturnNull"
let g:phpfmt_enable_default_mapping = 1     " Enable the mapping by default (<leader>pcd)

Default mapping is <leader>pcf (formats a file) and <leader>pcd (formats the whole directory of the file).

If you want to change it, update plugin/phpfmt.vim file, editing these lines:

nnoremap <silent><leader>pcd :call PhpFmtFixDirectory()<CR>
nnoremap <silent><leader>pcf :call PhpFmtFixFile()<CR>

Installation

Via Vundle, add:

Bundle 'dericofilho/vim-phpfmt'

Open VIM and execute: :PluginInstall

Via Pathogen, do:

cd ~/.vim/bundle
git clone [email protected]:dericofilho/vim-phpfmt.git

About

Vim plugin for php.tools

Resources

Stars

Watchers

Forks

Packages

No packages published