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

前端之家收集整理的这篇文章主要介绍了在Vim的quickfix列表的errorformat中,错误类型是什么?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我不确定Vim的quickfix列表中的%t格式说明符.它如何影响quickfix缓冲区的行为/显示

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

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

首先是以下错误格式:

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

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

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

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

  1. foo.h|1 | foobar

代替

  1. 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缓冲区将在行号后显示该信息,并以不同的颜色突出显示.例如,这是一个警告和错误

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

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

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

猜你在找的Bash相关文章