mirror of
https://github.com/amix/vimrc
synced 2025-07-14 15:34:59 +08:00
Updated plugins
This commit is contained in:
@ -1,29 +1,34 @@
|
||||
" Author: Andrew Balmos - <andrew@balmos.org>
|
||||
" Description: chktex for LaTeX files
|
||||
|
||||
let g:ale_tex_chktex_executable =
|
||||
\ get(g:, 'ale_tex_chktex_executable', 'chktex')
|
||||
call ale#Set('tex_chktex_executable', 'chktex')
|
||||
call ale#Set('tex_chktex_options', '-I')
|
||||
|
||||
let g:ale_tex_chktex_options =
|
||||
\ get(g:, 'ale_tex_chktex_options', '-I')
|
||||
function! ale_linters#tex#chktex#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'tex_chktex_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#tex#chktex#GetCommand(buffer) abort
|
||||
" Check for optional .chktexrc
|
||||
let l:chktex_config = ale#path#FindNearestFile(
|
||||
\ a:buffer,
|
||||
\ '.chktexrc')
|
||||
function! ale_linters#tex#chktex#GetCommand(buffer, version) abort
|
||||
let l:options = ''
|
||||
|
||||
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'
|
||||
let l:options .= ' -v0 -p stdin -q'
|
||||
|
||||
if !empty(l:chktex_config)
|
||||
let l:command .= ' -l ' . ale#Escape(l:chktex_config)
|
||||
" Avoid bug of reporting wrong column when using tabs (issue #723)
|
||||
if ale#semver#GTE(a:version, [1, 7, 7])
|
||||
let l:options .= ' -S TabSize=1'
|
||||
endif
|
||||
|
||||
let l:command .= ' ' . ale#Var(a:buffer, 'tex_chktex_options')
|
||||
" Check for optional .chktexrc
|
||||
let l:chktex_config = ale#path#FindNearestFile(a:buffer, '.chktexrc')
|
||||
|
||||
return l:command
|
||||
if !empty(l:chktex_config)
|
||||
let l:options .= ' -l ' . ale#Escape(l:chktex_config)
|
||||
endif
|
||||
|
||||
let l:options .= ' ' . ale#Var(a:buffer, 'tex_chktex_options')
|
||||
|
||||
return '%e' . l:options
|
||||
endfunction
|
||||
|
||||
function! ale_linters#tex#chktex#Handle(buffer, lines) abort
|
||||
@ -48,7 +53,12 @@ endfunction
|
||||
|
||||
call ale#linter#Define('tex', {
|
||||
\ 'name': 'chktex',
|
||||
\ 'executable': 'chktex',
|
||||
\ 'command': function('ale_linters#tex#chktex#GetCommand'),
|
||||
\ 'executable': function('ale_linters#tex#chktex#GetExecutable'),
|
||||
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
|
||||
\ buffer,
|
||||
\ ale_linters#tex#chktex#GetExecutable(buffer),
|
||||
\ '%e --version',
|
||||
\ function('ale_linters#tex#chktex#GetCommand'),
|
||||
\ )},
|
||||
\ 'callback': 'ale_linters#tex#chktex#Handle'
|
||||
\})
|
||||
|
Reference in New Issue
Block a user