summaryrefslogtreecommitdiffstats
path: root/.config/nvim/ale_linters
diff options
context:
space:
mode:
authorJustin Gassner <justin.gassner@mailbox.org>2024-01-10 13:29:11 +0100
committerJustin Gassner <justin.gassner@mailbox.org>2024-01-10 13:29:11 +0100
commit0dfdabd3d7c2aaee37900103c37a96317f3ada07 (patch)
treefe27ea564b60cf6e75b7f2dc3dc8bb57d78a3884 /.config/nvim/ale_linters
parent2a610aeff4a33456c03f0c8db1469cdc95ba1e73 (diff)
downloaddotfiles-0dfdabd3d7c2aaee37900103c37a96317f3ada07.tar.zst
config
Diffstat (limited to '.config/nvim/ale_linters')
-rw-r--r--.config/nvim/ale_linters/tex/textidote.vim32
1 files changed, 32 insertions, 0 deletions
diff --git a/.config/nvim/ale_linters/tex/textidote.vim b/.config/nvim/ale_linters/tex/textidote.vim
new file mode 100644
index 0000000..9640ef4
--- /dev/null
+++ b/.config/nvim/ale_linters/tex/textidote.vim
@@ -0,0 +1,32 @@
+" Author: Jordi Altayo <jordiag@kth.se>
+" Description: support for textidote grammar and syntax checker
+
+call ale#Set('tex_textidote_executable', 'textidote')
+call ale#Set('tex_textidote_options', '')
+
+function! ale_linters#tex#textidote#Handle(buffer, lines) abort
+ let l:pattern = '.*' . expand('%:t:r') . '\.tex(L\(\d\+\)C\(\d\+\)-L\d\+C\d\+): \(.*\)".*"'
+ let l:output = []
+
+ for l:match in ale#util#GetMatches(a:lines, l:pattern)
+ call add(l:output, {
+ \ 'lnum': l:match[1] + 0,
+ \ 'col' : l:match[2] + 0,
+ \ 'text': l:match[3],
+ \ 'type': 'E',
+ \})
+ endfor
+
+ return l:output
+endfunction
+
+function! ale_linters#tex#textidote#GetCommand(buffer) abort
+ return '%e --no-color --output singleline' . ale#Pad(ale#Var(a:buffer, 'tex_textidote_options')) . ale#Pad('%s')
+endfunction
+
+call ale#linter#Define('tex', {
+\ 'name': 'textidote',
+\ 'executable': {b -> ale#Var(b, 'tex_textidote_executable')},
+\ 'command': function('ale_linters#tex#textidote#GetCommand'),
+\ 'callback': 'ale_linters#tex#textidote#Handle',
+\})