summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorDerek P Sifford <dereksifford@gmail.com>2018-09-04 20:39:32 -0400
committerDerek P Sifford <dereksifford@gmail.com>2018-09-04 20:39:32 -0400
commit0ed4a5bbccaab69083d7dcde2154cdf9a43f3b54 (patch)
treeed31ddd4b0a313ae9515143dbcf90ab3cd7cd48f /autoload
parentd476578a402763f2c6e4e0ada2eb345d0ac938d7 (diff)
downloadale-0ed4a5bbccaab69083d7dcde2154cdf9a43f3b54.zip
add uncrustify fixer for several languages
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fix/registry.vim5
-rw-r--r--autoload/ale/fixers/uncrustify.vim16
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