为csslint消息找到vim efm

Ric*_*ick 5 css vim lint csslint

使用新发布的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%.%#
Run Code Online (Sandbox Code Playgroud)

但这并没有得到正确的行/列数.我在我的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;
...
Run Code Online (Sandbox Code Playgroud)

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 {
Run Code Online (Sandbox Code Playgroud)

有人看到我的efm有什么问题吗?或者有可能有用的东西?我试图不去编写另一个解析脚本来清理格式.谢谢您的帮助.

小智 2

在 Vim 的错误格式中,您需要使用双反斜杠来转义逗号。