Skip to content

Commit 0ec0dad

Browse files
committed
Update coz lib changed
1 parent 35c2536 commit 0ec0dad

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ This plugin will execute the `php-cs-fixer` command on the directory where you l
1010
```viml
1111
let g:php_cs_fixer_path = "~/php-cs-fixer.phar" " define the path to the php-cs-fixer.phar
1212
let g:php_cs_fixer_level = "all" " which level ?
13-
let g:php_cs_fixer_finder = "SymfonyFinder" " Which finder ?
13+
let g:php_cs_fixer_config = "default" " configuration
1414
let g:php_cs_fixer_php_path = "php" " Path to PHP
15+
let g:php_cs_fixer_fixers_list = "" " List of fixers
1516
let g:php_cs_fixer_default_mapping = 1 " Enable the mapping by default (<leader>pcd)
1617
let g:php_cs_fixer_dry_run = 0 " Call command with dry-run option
1718
```
@@ -35,3 +36,9 @@ Bundle 'stephpy/vim-php-cs-fixer'
3536
To see how to install `php-cs-fixer`, look at [php-cs-fixer](https://github.com/fabpot/PHP-CS-Fixer) repository.
3637

3738
If you see any improvement or question, contribute or create an issue
39+
40+
----------------------
41+
42+
Todo
43+
44+
- User can launch command for the actual file OR the actual dir.

plugin/php-cs-fixer.vim

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,27 @@ function! s:initVariable(var, value)
77
return 0
88
endfunction
99

10-
call s:initVariable("g:php_cs_fixer_default_mapping", 1)
11-
call s:initVariable("g:php_cs_fixer_php_path", "php")
12-
call s:initVariable("g:php_cs_fixer_finder", "SymfonyFinder")
13-
call s:initVariable("g:php_cs_fixer_level", "all")
1410
call s:initVariable("g:php_cs_fixer_path", "~/php-cs-fixer.phar")
15-
call s:initVariable("g:php_cs_fixer_dry_run", 1)
11+
call s:initVariable("g:php_cs_fixer_level", "all")
12+
call s:initVariable("g:php_cs_fixer_config", "default")
13+
call s:initVariable("g:php_cs_fixer_php_path", "php")
14+
call s:initVariable("g:php_cs_fixer_fixers_list", "")
15+
call s:initVariable("g:php_cs_fixer_default_mapping", 1)
16+
call s:initVariable("g:php_cs_fixer_dry_run", 0)
1617

17-
let g:php_cs_fixer_command = g:php_cs_fixer_php_path.' '.g:php_cs_fixer_path.' fix --level='.g:php_cs_fixer_level
18+
let g:php_cs_fixer_command = g:php_cs_fixer_php_path.' '.g:php_cs_fixer_path.' fix --config='.g:php_cs_fixer_config
1819

1920
fun! PhpCsFixerFix(path)
20-
let command = g:php_cs_fixer_command.' '.a:path.' '.g:php_cs_fixer_finder
21+
let command = g:php_cs_fixer_command.' '.a:path
22+
2123
if(g:php_cs_fixer_dry_run == 1)
2224
let command = command.' --dry-run'
2325
endif
26+
27+
if(strlen(g:php_cs_fixer_fixers_list))
28+
let command = command.' --fixers='.g:php_cs_fixer_fixers_list
29+
endif
30+
2431
exe ':! echo '.command.' && '.command
2532
endfun
2633

0 commit comments

Comments
 (0)