Vim Quickfix prefixes double-bar "||" — explain?

381 Views Asked by At

I use the Quickfix view in Vim often. The text in there always has a prefix of || added to it.

So, for instance, when I copy/paste out of that buffer, etc. I get those characters included by default.

Is there a way to disable this? I haven't had luck finding any documentation or configuration for this...

2

There are 2 best solutions below

0
On BEST ANSWER

It is now possible to customize the display of the quickfix window.

vim has introduced the quickfixtextfunc (:h qftf).

It allows exactly to customize the rendering of the quickfix window. The documentation includes an example, you can also see an example in the nvim-bqf README, although it's neovim/lua based.

You can see an example in the vim documentation in :h quickfix-window-function.

To implement a general-purpose qftf (not a specific one as in the vim documentation), you should start similarly than in the nvim-bqf readme, meaning, check if the info parameter quickfix field is 1, you should display items from getqflist, otherwise items from getloclist

5
On

Quickfix buffer is supposed to be used for parsing specially formatted strings (like compiler messages). This is done with the help of :h 'errorformat' option. And those "bars" are output separators between "filename", "line number" and "the message body".

If you have only "double bars" at the beginning of a line then you either have errorformat set wrong, or you misuse the quickfix buffer.

UPD. If you're interested, "Bars" are hardcoded in Vim's source (src/quickfix.c):

static int
qf_buf_add_line(buf_T *buf, linenr_T lnum, qfline_T *qfp, char_u *dirname)
{
    ...
    if (qfp->qf_module != NULL)
        ...
    if (len < IOSIZE - 1)
        IObuff[len++] = '|';
    if (qfp->qf_lnum > 0)
        ...
    if (len < IOSIZE - 2)
    {
        IObuff[len++] = '|';
        IObuff[len++] = ' ';
    }
    ...
}