Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stephpy/vim-php-cs-fixer
Use FriendsOfPHP/PHP-CS-Fixer
https://github.com/stephpy/vim-php-cs-fixer
Last synced: about 1 month ago
JSON representation
Use FriendsOfPHP/PHP-CS-Fixer
- Host: GitHub
- URL: https://github.com/stephpy/vim-php-cs-fixer
- Owner: stephpy
- Created: 2012-05-20T17:07:13.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2023-03-01T11:36:16.000Z (over 1 year ago)
- Last Synced: 2024-08-04T09:04:05.783Z (3 months ago)
- Language: Vim Script
- Homepage:
- Size: 62.5 KB
- Stars: 375
- Watchers: 12
- Forks: 37
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Vim-php-cs-fixer
================[![](https://img.shields.io/travis/stephpy/vim-php-cs-fixer.svg)](https://travis-ci.org/stephpy/vim-php-cs-fixer)
[![](https://img.shields.io/github/issues/stephpy/vim-php-cs-fixer.svg)](https://github.com/stephpy/vim-php-cs-fixer/issues)
[![](https://img.shields.io/badge/doc-%3Ah%20vim--php--cs--fixer-blue.svg)](doc/vim-php-cs-fixer.txt)
[![](https://img.shields.io/badge/license-MIT-blue.svg)](doc/vim-php-cs-fixer.txt)Integrate [php-cs-fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer).
This plugin will execute the `php-cs-fixer` command on the directory or file (depends on which command you call). See options to know how to customize that.
**Options available**:
```viml
" 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.x
let g:php_cs_fixer_level = "symfony" " options: --level (default:symfony)
let g: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.x
let g: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: --config
let g:php_cs_fixer_allow_risky = "yes" " options: --allow-risky
" End of php-cs-fixer version 2 config paramslet g:php_cs_fixer_php_path = "php" " Path to PHP
let g:php_cs_fixer_enable_default_mapping = 1 " Enable the mapping by default (pcd)
let g:php_cs_fixer_dry_run = 0 " Call command with dry-run option
let g: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 `pcd`
If you want to change it:
```viml
nnoremap pcd :call PhpCsFixerFixDirectory()
nnoremap pcf :call PhpCsFixerFixFile()
```If you want to add **fix on save** functionality, add this string to the end of ~/.vimrc:
```viml
autocmd BufWritePost *.php silent! call PhpCsFixerFixFile()
```# Installation
Via **[Vundle](https://github.com/gmarik/vundle)**, add:
```viml
Bundle 'stephpy/vim-php-cs-fixer'
```Via **[Pathogen](https://github.com/tpope/vim-pathogen)**, do:
```bash
cd ~/.vim/bundle
git clone [email protected]:stephpy/vim-php-cs-fixer.git
```To see how to install `php-cs-fixer`, look at [php-cs-fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) repository.
If you see any improvement or question, contribute or create an issue