X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/0ee596c5c5e11fc79598407eaf22f83d279f7e9e..5a4872f466ebd76ddd532bdf2798554421c53df4:/.vim/bundle/ale/ale_linters/rst/rstcheck.vim?ds=sidebyside diff --git a/.vim/bundle/ale/ale_linters/rst/rstcheck.vim b/.vim/bundle/ale/ale_linters/rst/rstcheck.vim new file mode 100644 index 00000000..e0cf0798 --- /dev/null +++ b/.vim/bundle/ale/ale_linters/rst/rstcheck.vim @@ -0,0 +1,31 @@ +" Author: John Nduli https://github.com/jnduli +" Description: Rstcheck for reStructuredText files + +function! ale_linters#rst#rstcheck#Handle(buffer, lines) abort + " matches: 'bad_rst.rst:1: (SEVERE/4) Title overline & underline + " mismatch.' + let l:pattern = '\v^(.+):(\d*): \(([a-zA-Z]*)/\d*\) (.+)$' + let l:dir = expand('#' . a:buffer . ':p:h') + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), + \ 'lnum': l:match[2] + 0, + \ 'col': 0, + \ 'type': l:match[3] is# 'SEVERE' ? 'E' : 'W', + \ 'text': l:match[4], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('rst', { +\ 'name': 'rstcheck', +\ 'executable': 'rstcheck', +\ 'cwd': '%s:h', +\ 'command': 'rstcheck %t', +\ 'callback': 'ale_linters#rst#rstcheck#Handle', +\ 'output_stream': 'both', +\})