Vim Syntastic: How to find out which syntax checker is currently in use?
Asked Answered
B

2

6

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?

Boonie answered 28/5, 2013 at 20:11 Comment(0)
H
10

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
Helminth answered 28/5, 2013 at 22:17 Comment(0)
H
0

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.

Hild answered 8/8, 2018 at 21:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.