加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

在Vim的quickfix列表的errorformat中,错误类型是什么?

发布时间:2020-12-16 01:09:59 所属栏目:安全 来源:网络整理
导读:我不确定Vim的quickfix列表中的%t格式说明符.它如何影响quickfix缓冲区的行为/显示? 我尝试使用以下测试文件找到它: $cat test.outfoo Error 1 foo.h foobarbar Error 2 foo.h foobarfoobar Warning 3 foo.h foobarbarfoo Warning 4 foo.h foobar 首先是
我不确定Vim的quickfix列表中的%t格式说明符.它如何影响quickfix缓冲区的行为/显示?

我尝试使用以下测试文件找到它:

$cat test.out
foo              Error         1 foo.h            foobar
bar              Error         2 foo.h            foobar
foobar           Warning       3 foo.h            foobar
barfoo           Warning       4 foo.h            foobar

首先是以下错误格式:

set errorformat+=%.%#%*s%.%#%*s%l %f%*s%m

有了这个错误格式,我可以使用:cgetfile test.out并跳转到foo.h中的行号,但是使用以下errorformat:

set errorformat+=%.%#%*s%t%.%#%*s%l %f%*s%m

所有改变的是现在我在quickfix缓冲区中的行号后面看到一些空格,例如我看到(1后两个空格)

foo.h|1  | foobar

代替

foo.h|1| foobar

所以我有两个问题:

>我的错误格式有什么问题?
>如果可以提取错误类型,我应该看到什么?

I’m unsure about the %t format specifier in Vim’s quickfix list,how does it affect the behavior/display of the quickfix buffer?

它告诉quickfix缓冲区匹配的错误类型(错误,警告或信息).然后,quickfix缓冲区将在行号后显示该信息,并以不同的颜色突出显示.例如,这是一个警告和错误:

hosts.cfg|3473 error| Could not add object property
hosts.cfg|3790 warning| Duplicate definition found for host 'mailgateway'

在quickfix窗口中,单词“warning”为黄色,单词“error”为白色,为红色.在我的错误格式中,我使用%t,其中E或W将出现错误或警告.例如:

%trror: %m in file '%f' on line %l

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读