summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fix/registry.vim5
-rw-r--r--autoload/ale/fixers/dfmt.vim18
2 files changed, 23 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index 7a553ccc..d21cb227 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -27,6 +27,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['python'],
\ 'description': 'Fix PEP8 issues with black.',
\ },
+\ 'dfmt': {
+\ 'function': 'ale#fixers#dfmt#Fix',
+\ 'suggested_filetypes': ['d'],
+\ 'description': 'Fix D files with dfmt.',
+\ },
\ 'fecs': {
\ 'function': 'ale#fixers#fecs#Fix',
\ 'suggested_filetypes': ['javascript', 'css', 'html'],
diff --git a/autoload/ale/fixers/dfmt.vim b/autoload/ale/fixers/dfmt.vim
new file mode 100644
index 00000000..0072e045
--- /dev/null
+++ b/autoload/ale/fixers/dfmt.vim
@@ -0,0 +1,18 @@
+" Author: theoldmoon0602
+" Description: Integration of dfmt with ALE.
+
+call ale#Set('d_dfmt_executable', 'dfmt')
+call ale#Set('d_dfmt_options', '')
+
+function! ale#fixers#dfmt#Fix(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'd_dfmt_executable')
+ let l:options = ale#Var(a:buffer, 'd_dfmt_options')
+
+ return {
+ \ 'command': ale#Escape(l:executable)
+ \ . ' -i'
+ \ . (empty(l:options) ? '' : ' ' . l:options)
+ \ . ' %t',
+ \ 'read_temporary_file': 1,
+ \}
+endfunction