简体   繁体   English

每个检查器的合成模式图

[英]Syntastic mode map per checker

Is there any way to separate the syntastic_mode (active vs. passive) depending on the checker? 是否有任何方法可以根据检查器来分离syntastic_mode(主动与被动)? For example, I want it to be active for 'php' (syntax) errors but passive for 'phpcs','phpmd' (style) checkers. 例如,我希望它对于“ php”(语法)错误是主动的,但对于“ phpcs”,“ phpmd”(样式)检查器是被动的。 Joonty's phpqa plugin can do something like that, but I'd prefer to avoid overlapping plugins and I like syntastic. Joonty的phpqa插件可以做类似的事情,但是我宁愿避免插件重叠,而且我喜欢syntastic。 Thanks! 谢谢!

Syntastic provides a map for that. Syntastic为此提供了一个地图。 The following makes syntastic passive for coffee script, but active for any other filetype. 以下内容使syntastic对于coffee脚本是被动的,但对于任何其他文件类型都是主动的。

let g:syntastic_mode_map = { 'mode': 'active',
            \ 'active_filetypes': [],
            \ 'passive_filetypes': ['coffee'] }

So the mode entry specifies the standard mode, while the other two entries specify the filetype specific behaviour. 因此, mode项指定标准模式,而其他两个项指定特定于文件类型的行为。

Modify to your needs and put it in your .vimrc. 修改您的需求并将其放在您的.vimrc中。

Syntastic modes are per filetype, not per checker. 同步模式是每个文件类型的,而不是每个检查器的。 However, you can set php to active, set the list of php checkers to just 'php' , and write a command to run phpcs and phpmd explicitly. 但是,您可以将php设置为active,将php checkers列表设置为'php' ,并编写一个命令来显式运行phpcsphpmd Perhaps like this: 也许像这样:

let g:syntastic_mode_map = { 'mode': 'active' }
let g:syntastic_php_checkers = ['php']
cabbrev syc SyntasticCheck phpcs phpmd

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

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