繁体   English   中英

查找csslint消息的vim efm

[英]finding vim efm for csslint messages

对于新发布的csslint,我想尝试将其挂接到vim作为.css文件的makefile。 我很难让多行错误格式适用于输出。

到目前为止,我最好的成绩是:

au BufRead *.css set makeprg=csslint\ %
au BufRead *.css set errorformat=%A%f:,%C%n:\ warning\ at\ line\ %l\,\ col\ %c,%C%m,%C%.%#,%C%.%#

但是,这并不能正确获得行/列号。 我在quickfix窗口中得到以下输出:

|| csslint: There are 33 errors and warnings in bookie.css.
|| 
bookie.css||  1: warning Too many font-size declarations (13), abstraction needed.
bookie.css||  2: warning at line 3, col 3 Rule is empty. BODY {
bookie.css||  3: warning at line 12, col 12 Values of 0 shouldn't have units specified. padding: .5em 0em;
bookie.css||  4: warning at line 13, col 13 Values of 0 shouldn't have units specified. margin: 0em;
...

csslint的格式为:

csslint: There are 33 errors and warnings in bookie.css.

bookie.css:
1: warning
Too many font-size declarations (13), abstraction needed.

bookie.css:
2: warning at line 3, col 3
Rule is empty.
BODY {

有人看到我的efm有什么问题吗? 或有可能有效的方法? 我试图不走写另一个解析脚本来清理格式的路线。 谢谢您的帮助。

您需要使用双反斜杠来转义Vim的errorformat中的逗号。

我只是使用CSS Lint将CSS语法检查器提交给Syntastic插件 只需从GitHub上获取最新的Syntastic版本 ,然后安装CSS Lint CLI工具 ,您就可以开始使用。

请注意,CSS Lint的警告/错误格式相当吸引人,但是我编写的插件可以很好地处理它。 我希望将来会有所改善。

使用vim的errorformat确实是一场噩梦。 通常我会在shell中为vim重新编写lint输出,尽管使用--format=compact开关还是可以的。

set makeprg=csslint\ --format=compact\ %
set errorformat=%f:\ line\ %l\\,\ col\ \%c\\,\ %m

来源: https : //github.com/kaihendry/vim-html5/blob/master/ftplugin/css.vim

暂无
暂无

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

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