How to set up syntastic for vim?

protossor picture protossor · Mar 17, 2013 · Viewed 22.8k times · Source

So I git cloned the repository to ~/.vim/bundle and had pathogen installed. I can be sure pathogen works fine since my other plugins in bundle are all working fine. After googling for a while, it seems that syntastic should work out of box for c code. I also checked that I have all the executables specified in syntastic/syntax_checkers/c/.

Here is a part of my .vimrc file:

" syntastic
let g:syntastic_auto_loc_list=1
let g:syntastic_disabled_filetypes=['html']
let g:syntastic_enable_signs=1

When I open a *.c file and do :SyntasticCheck, nothing happens. There is no errors complaining command not found, so syntastic is loaded. However, even if the *.c file that's currently opened contains errors syntax error, syntastic is not showing anything.

It is the first time I use syntastic so I don't really know the correct way to invoke it.

I also tried :SyntasticCheck [c] and I get the following error message:

Error detected while processing function <SNR>_22_UpdateErrors..<SNR>22_CacheErrors:
line 16:
E121: Undefined variable: checkers
E15: Invalid expression: checkers

Can someone tell me what I did wrong and how to invoke syntastic? Thanks!

Answer

Evan Hahn picture Evan Hahn · Mar 18, 2013

Try adding this to your vimrc:

let g:syntastic_check_on_open=1
let g:syntastic_enable_signs=1

(This is lifted straight from my vimrc, which has some other Syntastic settings if you'd like.)