@@ -3,27 +3,20 @@ if exists("g:vim_php_cs_fixer") || &cp
3
3
endif
4
4
let g: vim_php_cs_fixer = 1
5
5
6
- " Taken from NerdTree
7
- function ! s: initVariable (var , value)
8
- if ! exists (a: var )
9
- exec ' let ' . a: var . ' = ' . " '" . substitute (a: value , " '" , " ''" , " g" ) . " '"
10
- return 1
11
- endif
12
- return 0
13
- endfunction
14
-
15
- call s: initVariable (" g:php_cs_fixer_path" , " ~/php-cs-fixer.phar" )
16
- call s: initVariable (" g:php_cs_fixer_level" , " all" )
17
- call s: initVariable (" g:php_cs_fixer_php_path" , " php" )
18
- call s: initVariable (" g:php_cs_fixer_enable_default_mapping" , 1 )
19
- call s: initVariable (" g:php_cs_fixer_dry_run" , 0 )
20
- call s: initVariable (" g:php_cs_fixer_verbose" , 0 )
6
+ " Global options definition."{{{
7
+ let g: php_cs_fixer_path = get (g: , ' php_cs_fixer_path' , ' ~/php-cs-fixer.phar' )
8
+ let g: php_cs_fixer_level = get (g: , ' php_cs_fixer_level' , ' all' )
9
+ let g: php_cs_fixer_php_path = get (g: , ' php_cs_fixer_php_path' , ' php' )
10
+ let g: php_cs_fixer_enable_default_mapping = get (g: , ' php_cs_fixer_enable_default_mapping' , ' 1' )
11
+ let g: php_cs_fixer_dry_run = get (g: , ' php_cs_fixer_dry_run' , 0 )
12
+ let g: php_cs_fixer_verbose = get (g: , ' php_cs_fixer_verbose' , 0 )
21
13
22
14
let g: php_cs_fixer_command = g: php_cs_fixer_php_path .' ' .g: php_cs_fixer_path .' fix'
23
15
24
16
if exists (' g:php_cs_fixer_config' )
25
17
let g: php_cs_fixer_command = g: php_cs_fixer_command .' --config=' .g: php_cs_fixer_config
26
18
endif
19
+ " }}}
27
20
28
21
29
22
fun ! PhpCsFixerFix (path , dry_run)
@@ -77,3 +70,5 @@ if(g:php_cs_fixer_enable_default_mapping == 1)
77
70
nnoremap <silent> <leader> pcd :call PhpCsFixerFixDirectory()<CR>
78
71
nnoremap <silent> <leader> pcf :call PhpCsFixerFixFile()<CR>
79
72
endif
73
+
74
+ " vim: foldmethod = marker
0 commit comments