Suppose a source code interpreter outputs the error messages in the following format:M123 Warning path/to/file 123 Description messageThat is:error_code error_type file line_number messageHow can I set errorformat such that I get both the error_code and message in the quickfix window?Please note that error_type can be any string, with and without numbers.
How to merge multiple strings in errorformat
errorformat
You can't do this with errorformat alone, but there are a couple of ways to do it. One is to filter the output of your interpreter with another program like this::set mp=make\ \\\|&\ error_filteras explained in an un-indexed paragraph in the reference manual. To find it, execute :help quickfix-directory-stack and scroll up to the previous section titled Filtering messages.Another way is to post-process the contents of the quickfix list as described under :help QuickFixCmdPost-example.Using either method, edit the error message to put error_code next to message and use an errorformat that sees them together as just a message (%m).