Skip to content

Commit d7e64b8

Browse files
committed
do not add --config if user does not define it
1 parent 1eef3e0 commit d7e64b8

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

plugin/php-cs-fixer.vim

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,17 @@ endfunction
1414

1515
call s:initVariable("g:php_cs_fixer_path", "~/php-cs-fixer.phar")
1616
call s:initVariable("g:php_cs_fixer_level", "all")
17-
call s:initVariable("g:php_cs_fixer_config", "default")
1817
call s:initVariable("g:php_cs_fixer_php_path", "php")
19-
call s:initVariable("g:php_cs_fixer_fixers_list", "")
2018
call s:initVariable("g:php_cs_fixer_default_mapping", 1)
2119
call s:initVariable("g:php_cs_fixer_dry_run", 0)
2220
call s:initVariable("g:php_cs_fixer_verbose", 0)
2321

24-
let g:php_cs_fixer_command = g:php_cs_fixer_php_path.' '.g:php_cs_fixer_path.' fix --config='.g:php_cs_fixer_config
22+
let g:php_cs_fixer_command = g:php_cs_fixer_php_path.' '.g:php_cs_fixer_path.' fix'
23+
24+
if exists('g:php_cs_fixer_config')
25+
let g:php_cs_fixer_command = g:php_cs_fixer_command.' --config='.g:php_cs_fixer_config
26+
endif
27+
2528

2629
fun! PhpCsFixerFix(path, dry_run)
2730
let command = g:php_cs_fixer_command.' '.a:path
@@ -31,7 +34,7 @@ fun! PhpCsFixerFix(path, dry_run)
3134
let command = command.' --dry-run'
3235
endif
3336

34-
if strlen(g:php_cs_fixer_fixers_list)
37+
if exists('g:php_cs_fixer_fixers_list')
3538
let command = command.' --fixers='.g:php_cs_fixer_fixers_list
3639
endif
3740

0 commit comments

Comments
 (0)