dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit cf2257de868f11c526342609292b7d6ce54d60b3
parent 6bbfa1ee3ddc4c93cd5002ccaebbe113eb4a527b
Author: Alex Balgavy <alex@balgavy.eu>
Date:   Fri, 29 Jul 2022 20:14:14 +0200

vim: add textidote to ALE

Diffstat:
Avim/autoload/ale_linters/tex/textidote.vim | 32++++++++++++++++++++++++++++++++
Mvim/vimrc | 13+++++++++++++
2 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/vim/autoload/ale_linters/tex/textidote.vim b/vim/autoload/ale_linters/tex/textidote.vim @@ -0,0 +1,32 @@ +" Author: Jordi Altayo <jordiag@kth.se>, Juan Pablo Stumpf +" <juanolon@gmail.com> +" Description: support for textidote grammar and syntax checker + +function! ale_linters#tex#textidote#GetExecutable(buffer) abort + let l:exe = ale#Var(a:buffer, 'tex_textidote_executable') + let l:exe .= ' ' . ale#Var(a:buffer, 'tex_textidote_options') + + let l:check_lang = ale#Var(a:buffer, 'tex_textidote_check_lang') + + if !empty(l:check_lang) + let l:exe .= ' --check ' . l:check_lang + endif + + return l:exe . ' ' . expand('#' . a:buffer . ':p') +endfunction + +function! ale_linters#tex#textidote#Handle(buffer, lines) abort + let l:pattern = '.*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 diff --git a/vim/vimrc b/vim/vimrc @@ -453,6 +453,19 @@ let g:ale_c_clangformat_options = '-std=gnu99 -Wall' let g:ale_c_clangtidy_options = '-std=gnu99 -Wall' let g:ale_c_clangtidy_extra_options = '-std=gnu99 -Wall' let g:ale_perl_perlcritic_options = '--brutal' + +call ale#Set('tex_textidote_executable', 'textidote') +call ale#Set('tex_textidote_options', '--no-color --output singleline') +" TODO get language from spell spelllang +call ale#Set('tex_textidote_check_lang', '') +call ale#linter#Define('tex', { +\ 'name': 'textidote', +\ 'output_stream': 'stdout', +\ 'executable': {b -> ale#Var(b, 'tex_textidote_executable')}, +\ 'command': function('ale_linters#tex#textidote#GetExecutable'), +\ 'callback': 'ale_linters#tex#textidote#Handle', +\}) + " indentLine {{{3 let g:indentLine_char_list = ['|', '¦', '┆', '┊'] let g:indentLine_enable = 0 " off by default