Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Use FriendsOfPHP/PHP-CS-Fixer

NotificationsYou must be signed in to change notification settings

stephpy/vim-php-cs-fixer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Integratephp-cs-fixer.

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

Options available:

" If php-cs-fixer is in $PATH, you don't need to define line below" let g:php_cs_fixer_path = "~/php-cs-fixer.phar" " define the path to the php-cs-fixer.phar" If you use php-cs-fixer version 1.xletg:php_cs_fixer_level="symfony"" options: --level (default:symfony)letg:php_cs_fixer_config="default"" options: --config" If you want to define specific fixers:"let g:php_cs_fixer_fixers_list = "linefeed,short_tag" " options: --fixers"let g:php_cs_fixer_config_file = '.php_cs'            " options: --config-file" End of php-cs-fixer version 1 config params" If you use php-cs-fixer version 2.xletg:php_cs_fixer_rules="@PSR2"" options: --rules (default:@PSR2)"let g:php_cs_fixer_cache = ".php_cs.cache" " options: --cache-file"let g:php_cs_fixer_config_file = '.php_cs' " options: --configletg:php_cs_fixer_allow_risky="yes"" options: --allow-risky" End of php-cs-fixer version 2 config paramsletg:php_cs_fixer_php_path="php"" Path to PHPletg:php_cs_fixer_enable_default_mapping=1" Enable the mapping by default (<leader>pcd)letg:php_cs_fixer_dry_run=0" Call command with dry-run optionletg:php_cs_fixer_verbose=0" Return the output of command if 1, else an inline information." let g:php_cs_fixer_ignore_env = 1               " Ignoring any environment requirements

Default mapping is<leader>pcd

If you want to change it:

nnoremap<silent><leader>pcd :call PhpCsFixerFixDirectory()<CR>nnoremap<silent><leader>pcf :call PhpCsFixerFixFile()<CR>

If you want to addfix on save functionality, add this string to the end of ~/.vimrc:

autocmdBufWritePost*.phpsilent!callPhpCsFixerFixFile()

Installation

ViaVundle, add:

Bundle'stephpy/vim-php-cs-fixer'

ViaPathogen, do:

cd~/.vim/bundlegit clone git@github.com:stephpy/vim-php-cs-fixer.git

To see how to installphp-cs-fixer, look atphp-cs-fixer repository.

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

About

Use FriendsOfPHP/PHP-CS-Fixer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors18


[8]ページ先頭

©2009-2026 Movatter.jp