summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorTANIGUCHI Masaya <xtaniguchimasaya+code@gmail.com>2019-01-11 03:53:45 +0900
committerw0rp <w0rp@users.noreply.github.com>2019-01-10 18:53:45 +0000
commitfabebb3a47d41b31d900e98e6f96b61524eec6aa (patch)
tree8e1df094af0f960de19cfacd077de53c004a5f27 /autoload
parent721183116e91d3988185c7ca87a409f3488c5b01 (diff)
downloadale-fabebb3a47d41b31d900e98e6f96b61524eec6aa.zip
Add textlint for Asciidoc and add it to Fixers (#2193)
* Add textlint for asciidoc * Add textlint --fix
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fix/registry.vim5
-rw-r--r--autoload/ale/fixers/textlint.vim15
2 files changed, 20 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index 6a8fd382..a7422f22 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -170,6 +170,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['rust'],
\ 'description': 'Fix Rust files with Rustfmt.',
\ },
+\ 'textlint': {
+\ 'function': 'ale#fixers#textlint#Fix',
+\ 'suggested_filetypes': ['text','markdown','asciidoc'],
+\ 'description': 'Fix text files with textlint --fix',
+\ },
\ 'hackfmt': {
\ 'function': 'ale#fixers#hackfmt#Fix',
\ 'suggested_filetypes': ['hack'],
diff --git a/autoload/ale/fixers/textlint.vim b/autoload/ale/fixers/textlint.vim
new file mode 100644
index 00000000..38ab2bfd
--- /dev/null
+++ b/autoload/ale/fixers/textlint.vim
@@ -0,0 +1,15 @@
+" Author: TANIGUCHI Masaya <ta2gch@gmail.com>
+" Description: Integration of textlint with ALE.
+
+function! ale#fixers#textlint#Fix(buffer) abort
+ let l:executable = ale#handlers#textlint#GetExecutable(a:buffer)
+ let l:options = ale#Var(a:buffer, 'textlint_options')
+
+ return {
+ \ 'command': ale#Escape(l:executable)
+ \ . ' --fix'
+ \ . (empty(l:options) ? '' : ' ' . l:options)
+ \ . ' %t',
+ \ 'read_temporary_file': 1,
+ \}
+endfunction