summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2018-09-09 11:30:30 +0100
committerGitHub <noreply@github.com>2018-09-09 11:30:30 +0100
commit395aba19c37a4bc4ead34f115381227d7b71bc0a (patch)
tree54d00658f7d339bba7cb85511f160efffbbb3f89 /autoload
parent0ae4ea23c8573f9c693fcd5cd5ff9a3acc795b58 (diff)
parent6e4dccc0e0888ea44f6914d6a8b16744492f2215 (diff)
downloadale-395aba19c37a4bc4ead34f115381227d7b71bc0a.zip
Merge pull request #1885 from dsifford/dsifford-fixer-uncrustify
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