简体   繁体   English

如何为vim设置合成?

[英]How to set up syntastic for vim?

So I git cloned the repository to ~/.vim/bundle and had pathogen installed. 所以我git将存储~/.vim/bundle~/.vim/bundle并安装了病原体。 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. 谷歌搜索了一段时间后,似乎合成代码应该开箱即用于c代码。 I also checked that I have all the executables specified in syntastic/syntax_checkers/c/ . 我还检查了我在syntastic/syntax_checkers/c/指定的所有可执行文件。

Here is a part of my .vimrc file: 这是我的.vimrc文件的一部分:

" 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. 当我打开* .c文件并执行:SyntasticCheck ,没有任何反应。 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. 但是,即使当前打开的* .c文件包含错误语法错误,syntastic也不会显示任何内容。

It is the first time I use syntastic so I don't really know the correct way to invoke it. 这是我第一次使用syntastic,所以我真的不知道调用它的正确方法。

I also tried :SyntasticCheck [c] and I get the following error message: 我也试过:SyntasticCheck [c] ,我收到以下错误信息:

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! 谢谢!

Try adding this to your vimrc: 尝试将此添加到您的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.) (这是直接从我的vimrc中解除的,如果你愿意的话,还有其他一些Syntastic设置。)

I don't really understand the reason, but when I re-installed the YouCompleteMe plugin for vim with ./install.sh --clang-completer . 我真的不明白原因,但是当我用./install.sh --clang-completer重新安装vim的YouCompleteMe插件时。 Syntastic works like charm. 合成作品就像魅力。

I did two things and then Syntastic started to behave as expected with JS files and ESlint. 我做了两件事,然后Syntastic开始按照预期的方式使用JS文件和ESlint。 Can't tell which one did the trick: 不知道哪个人做了诀窍:

1- In the project's directory ran eslint --init . 1-在项目目录中运行eslint --init

2- Started vim opening the file without the -S flag. 2-开始vim打开没有-S标志的文件。

Before it failed silently, no errors and no diagnostics. 在它静默失败之前,没有错误,也没有诊断。 This is how ESlint behaves when there is no configuration file. 这是ESlint在没有配置文件时的行为方式。

安装clang和/或ctags包为我修复了这个问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM