mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Removed syntastic and replaced it with ale
Read more here: https://github.com/w0rp/ale
This commit is contained in:
11
sources_non_forked/ale/ale_linters/tex/alex.vim
Normal file
11
sources_non_forked/ale/ale_linters/tex/alex.vim
Normal file
@ -0,0 +1,11 @@
|
||||
" Author: Johannes Wienke <languitar@semipol.de>
|
||||
" Description: alex for TeX files
|
||||
|
||||
call ale#linter#Define('tex', {
|
||||
\ 'name': 'alex',
|
||||
\ 'executable': 'alex',
|
||||
\ 'command': 'alex %s -t',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale#handlers#alex#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
54
sources_non_forked/ale/ale_linters/tex/chktex.vim
Normal file
54
sources_non_forked/ale/ale_linters/tex/chktex.vim
Normal file
@ -0,0 +1,54 @@
|
||||
" Author: Andrew Balmos - <andrew@balmos.org>
|
||||
" Description: chktex for LaTeX files
|
||||
|
||||
let g:ale_tex_chktex_executable =
|
||||
\ get(g:, 'ale_tex_chktex_executable', 'chktex')
|
||||
|
||||
let g:ale_tex_chktex_options =
|
||||
\ get(g:, 'ale_tex_chktex_options', '-I')
|
||||
|
||||
function! ale_linters#tex#chktex#GetCommand(buffer) abort
|
||||
" Check for optional .chktexrc
|
||||
let l:chktex_config = ale#path#FindNearestFile(
|
||||
\ a:buffer,
|
||||
\ '.chktexrc')
|
||||
|
||||
let l:command = ale#Var(a:buffer, 'tex_chktex_executable')
|
||||
" Avoid bug when used without -p (last warning has gibberish for a filename)
|
||||
let l:command .= ' -v0 -p stdin -q'
|
||||
|
||||
if !empty(l:chktex_config)
|
||||
let l:command .= ' -l ' . ale#Escape(l:chktex_config)
|
||||
endif
|
||||
|
||||
let l:command .= ' ' . ale#Var(a:buffer, 'tex_chktex_options')
|
||||
|
||||
return l:command
|
||||
endfunction
|
||||
|
||||
function! ale_linters#tex#chktex#Handle(buffer, lines) abort
|
||||
" Mattes lines like:
|
||||
"
|
||||
" stdin:499:2:24:Delete this space to maintain correct pagereferences.
|
||||
" stdin:507:81:3:You should enclose the previous parenthesis with `{}'.
|
||||
let l:pattern = '^stdin:\(\d\+\):\(\d\+\):\(\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[4] . ' (' . (l:match[3]+0) . ')',
|
||||
\ 'type': 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('tex', {
|
||||
\ 'name': 'chktex',
|
||||
\ 'executable': 'chktex',
|
||||
\ 'command_callback': 'ale_linters#tex#chktex#GetCommand',
|
||||
\ 'callback': 'ale_linters#tex#chktex#Handle'
|
||||
\})
|
47
sources_non_forked/ale/ale_linters/tex/lacheck.vim
Normal file
47
sources_non_forked/ale/ale_linters/tex/lacheck.vim
Normal file
@ -0,0 +1,47 @@
|
||||
" Author: Andrew Balmos - <andrew@balmos.org>
|
||||
" Description: lacheck for LaTeX files
|
||||
|
||||
let g:ale_tex_lacheck_executable =
|
||||
\ get(g:, 'ale_tex_lacheck_executable', 'lacheck')
|
||||
|
||||
function! ale_linters#tex#lacheck#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'tex_lacheck_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#tex#lacheck#GetCommand(buffer) abort
|
||||
return ale#Var(a:buffer, 'tex_lacheck_executable') . ' %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#tex#lacheck#Handle(buffer, lines) abort
|
||||
" Mattes lines like:
|
||||
"
|
||||
" "book.tex", line 37: possible unwanted space at "{"
|
||||
" "book.tex", line 38: missing `\ ' after "etc."
|
||||
|
||||
let l:pattern = '^".\+", line \(\d\+\): \(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
" lacheck follows `\input{}` commands. If the cwd is not the same as the
|
||||
" file in the buffer then it will fail to find the inputed items. We do not
|
||||
" want warnings from those items anyway
|
||||
if !empty(matchstr(l:match[2], '^Could not open ".\+"$'))
|
||||
continue
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'text': l:match[2],
|
||||
\ 'type': 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('tex', {
|
||||
\ 'name': 'lacheck',
|
||||
\ 'executable_callback': 'ale_linters#tex#lacheck#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#tex#lacheck#GetCommand',
|
||||
\ 'callback': 'ale_linters#tex#lacheck#Handle'
|
||||
\})
|
9
sources_non_forked/ale/ale_linters/tex/proselint.vim
Normal file
9
sources_non_forked/ale/ale_linters/tex/proselint.vim
Normal file
@ -0,0 +1,9 @@
|
||||
" Author: poohzrn https://github.com/poohzrn
|
||||
" Description: proselint for TeX files
|
||||
|
||||
call ale#linter#Define('tex', {
|
||||
\ 'name': 'proselint',
|
||||
\ 'executable': 'proselint',
|
||||
\ 'command': 'proselint %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
9
sources_non_forked/ale/ale_linters/tex/redpen.vim
Normal file
9
sources_non_forked/ale/ale_linters/tex/redpen.vim
Normal file
@ -0,0 +1,9 @@
|
||||
" Author: rhysd https://rhysd.github.io
|
||||
" Description: Redpen, a proofreading tool (http://redpen.cc)
|
||||
|
||||
call ale#linter#Define('tex', {
|
||||
\ 'name': 'redpen',
|
||||
\ 'executable': 'redpen',
|
||||
\ 'command': 'redpen -f latex -r json %t',
|
||||
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
|
||||
\})
|
9
sources_non_forked/ale/ale_linters/tex/vale.vim
Normal file
9
sources_non_forked/ale/ale_linters/tex/vale.vim
Normal file
@ -0,0 +1,9 @@
|
||||
" Author: chew-z https://github.com/chew-z
|
||||
" Description: vale for LaTeX files
|
||||
|
||||
call ale#linter#Define('tex', {
|
||||
\ 'name': 'vale',
|
||||
\ 'executable': 'vale',
|
||||
\ 'command': 'vale --output=JSON %t',
|
||||
\ 'callback': 'ale#handlers#vale#Handle',
|
||||
\})
|
9
sources_non_forked/ale/ale_linters/tex/write-good.vim
Normal file
9
sources_non_forked/ale/ale_linters/tex/write-good.vim
Normal file
@ -0,0 +1,9 @@
|
||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for TeX files
|
||||
|
||||
call ale#linter#Define('tex', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
Reference in New Issue
Block a user