diff options
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/fix/registry.vim | 5 | ||||
-rw-r--r-- | autoload/ale/fixers/uncrustify.vim | 16 |
2 files changed, 21 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim index 1ca54a86..0a54f49e 100644 --- a/autoload/ale/fix/registry.vim +++ b/autoload/ale/fix/registry.vim @@ -235,6 +235,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['xml'], \ 'description': 'Fix XML files with xmllint.', \ }, +\ 'uncrustify': { +\ 'function': 'ale#fixers#uncrustify#Fix', +\ 'suggested_filetypes': ['c', 'cpp', 'cs', 'objc', 'objcpp', 'd', 'java', 'p', 'vala' ], +\ 'description': 'Fix C, C++, C#, ObjectiveC, ObjectiveC++, D, Java, Pawn, and VALA files with uncrustify.', +\ }, \} " Reset the function registry to the default entries. diff --git a/autoload/ale/fixers/uncrustify.vim b/autoload/ale/fixers/uncrustify.vim new file mode 100644 index 00000000..ffec18ef --- /dev/null +++ b/autoload/ale/fixers/uncrustify.vim @@ -0,0 +1,16 @@ +" Author: Derek P Sifford <dereksifford@gmail.com> +" Description: Fixer for C, C++, C#, ObjectiveC, D, Java, Pawn, and VALA. + +call ale#Set('c_uncrustify_executable', 'uncrustify') +call ale#Set('c_uncrustify_options', '') + +function! ale#fixers#uncrustify#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'c_uncrustify_executable') + let l:options = ale#Var(a:buffer, 'c_uncrustify_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' --no-backup' + \ . (empty(l:options) ? '' : ' ' . l:options) + \} +endfunction |