I would like to change a setting or edit a line of code in the Python syntax checker, but Syntastic comes with five of them. How can I find out which one is in use?
Vim Syntastic: How to find out which syntax checker is currently in use?
Syntastic has a built-in function for this. I believe which syntax checkers are available depend on your system.
:SyntasticInfo
Syntastic info for filetype: python
Available checkers: python
Currently active checker(s): python
Press ENTER or type command to continue
Frustratingly there doesn't seem to be a direct way to return the available checkers as a vim script string or list. Wrote this function that uses :redir
to do so:
function! s:syntastic_checkers(...)
redir => output
silent SyntasticInfo
redir END
let result=split(output, "\n")
let checkers=split(split(result[-2], ':')[-1], '\s\+')
if checkers[0]=='-'
let checkers=[]
else
call extend(checkers, split(split(result[-1], ':')[-1], '\s\+')[:1])
endif
if a:0 "just echo the result
echo 'Checkers: '.join(checkers, ', ')
else
return checkers
endif
endfunction
command! SyntasticCheckers
Call it with any argument to print a list of checkers, and call it without any arguments to return a vim list of checkers, plus the current checker in the final position of the list.
© 2022 - 2024 — McMap. All rights reserved.