summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorRiley Martine <riley.martine@protonmail.com>2019-04-13 20:21:59 +0800
committerw0rp <w0rp@users.noreply.github.com>2019-04-13 13:21:59 +0100
commit495bce32e957dcf45d6d6acf183599e18c92b09d (patch)
treef82cc04c19d10351b5021ef83e0951f58e2c9eeb /autoload
parentf0f0cc3c186c46f437d62e6b3e01a45d2a3aaf47 (diff)
downloadale-495bce32e957dcf45d6d6acf183599e18c92b09d.zip
Add support for latexindent (#2387)
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fix/registry.vim5
-rw-r--r--autoload/ale/fixers/latexindent.vim18
2 files changed, 23 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index 23d32f03..2b43e40a 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -285,6 +285,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['kt'],
\ 'description': 'Fix Kotlin files with ktlint.',
\ },
+\ 'latexindent': {
+\ 'function': 'ale#fixers#latexindent#Fix',
+\ 'suggested_filetypes': ['tex'],
+\ 'description' : 'Indent code within environments, commands, after headings and within special code blocks.',
+\ },
\}
" Reset the function registry to the default entries.
diff --git a/autoload/ale/fixers/latexindent.vim b/autoload/ale/fixers/latexindent.vim
new file mode 100644
index 00000000..b0a0884a
--- /dev/null
+++ b/autoload/ale/fixers/latexindent.vim
@@ -0,0 +1,18 @@
+" Author: riley-martine <riley.martine@protonmail.com>
+" Description: Integration of latexindent with ALE.
+
+call ale#Set('tex_latexindent_executable', 'latexindent')
+call ale#Set('tex_latexindent_options', '')
+
+function! ale#fixers#latexindent#Fix(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'tex_latexindent_executable')
+ let l:options = ale#Var(a:buffer, 'tex_latexindent_options')
+
+ return {
+ \ 'command': ale#Escape(l:executable)
+ \ . ' -l -w'
+ \ . (empty(l:options) ? '' : ' ' . l:options)
+ \ . ' %t',
+ \ 'read_temporary_file': 1,
+ \}
+endfunction