How to set up syntastic for vim?

*爱你&永不变心* 提交于 2019-11-29 19:14:07

问题


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!


回答1:


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.)




回答2:


I don't really understand the reason, but when I re-installed the YouCompleteMe plugin for vim with ./install.sh --clang-completer. Syntastic works like charm.




回答3:


I did two things and then Syntastic started to behave as expected with JS files and ESlint. Can't tell which one did the trick:

1- In the project's directory ran eslint --init.

2- Started vim opening the file without the -S flag.

Before it failed silently, no errors and no diagnostics. This is how ESlint behaves when there is no configuration file.




回答4:


Installing clang and/or ctags packages fixed this for me



来源:https://stackoverflow.com/questions/15457887/how-to-set-up-syntastic-for-vim

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!