Open dkasak opened 5 years ago
" Author: Jordi Altayo <jordiag@kth.se>
" Description: support for textidote grammar and syntax checker
let g:ale_tex_textidote_executable = 'textidote'
let g:ale_tex_textidote_options = '--output singleline'
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
call ale#linter#Define('tex', {
\ 'name': 'textidote',
\ 'output_stream': 'stdout',
\ 'executable': 'textidote',
\ 'command': 'textidote --no-color --output singleline ' . expand('%'),
\ 'callback': 'ale_linters#tex#textidote#Handle',
\})
Right now I don't have time to write the tests and create the pull request (will do it at some point) but this works with textidote, just place it under .vim/plugged/ale/ale_linters/tex/textidote.vim
Please see quote from :help ale#linter#Define
below. It should be safe to skip setting output_stream
.
This argument defaults to
'stdout'
.
Name: textidote URL: https://github.com/sylvainhalle/textidote
This is a linter for LaTeX which strips away LaTeX commands, but remembering the original positions of the text. It then passes the text to LanguageTool and can map errors from it back to the correct LaTeX source file locations.
They also recently added support for Markdown.