vim-phpfmt


Ⅰ. 插件描述

Vim plugin for php.tools

Ⅱ. 基本信息

创建日期:  2015-01-17
使用用户:  2
Github星:  16
插件作者:  phpfmt

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'dericofilho/vim-phpfmt'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'dericofilho/vim-phpfmt'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'dericofilho/vim-phpfmt'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/dericofilho/vim-phpfmt

Ⅳ. 文档说明

Vim-phpfmt

This project follows a Code of Conduct.

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

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 phpfmt 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 git@github.com:dericofilho/vim-phpfmt.git

Via vim-plug, add:

Plug 'phpfmt/vim-phpfmt'

Open VIM and execute:
:PlugInstall

添加新评论