I’m unsure about the %t
format specifier in Vim’s quickfix list. How does it affect the behavior/display of the quickfix buffer?
I tried to find it out with the following test file:
$ 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
And the following errorformat
first:
set errorformat+=%.%#%*\\s%.%#%*\\s%l\ %f%*\\s%m
With this errorformat
in place I can use :cgetfile test.out
and jump to the line numbers in foo.h
, but with the following errorformat
:
set errorformat+=%.%#%*\\s%t%.%#%*\\s%l\ %f%*\\s%m
All that has changed is that now I see some spaces after the line numbers in the quickfix buffer, e.g. I see (two spaces after the 1)
foo.h|1 | foobar
instead of
foo.h|1| foobar
So I have two questions:
- What is wrong with my
errorformat
? - What should I see if the error type could be extracted?
It tells the quickfix buffer what type of error a match is (error, warning, or informational). The quickfix buffer will then show that information after the line number and highlight it in a different color. For example, here is a warning and an error:
In the quickfix window the word "warning" is in yellow and the word "error" is white on red. In my errorformat I am using %t where the E or W would be in Error or Warning. For example: