1

I'm building a project with a large amount of warnings. To get through those I'd like to address certain warnings first. I use :make and then I want to filter to quickfix list. I do this as follows (I'm quite new to this, so please let me know if there is a better way):

Bring up the quickfix window with :cw and set it modifiable. Then I filter the lines (for instance with g!/pattern/d). Finally, (as I understood should be possible) I use the modified quickfix buffer as new quickfix list with :cbuffer.

An example looks like this:

src/lib/mfb/mfbbasic.c|24 col 1| note: include ‘<string.h>’ or provide a declaration of ‘strlen’
||    23 | #include "../../include/mfb.h"
||   +++ |+#include <string.h>      
||    24 | #include <stdio.h>      

After editing and running :cbuffer, it changes and now looks like this:

|| src/lib/mfb/mfbbasic.c|24 col 1| note: include ‘<string.h>’ or provide a declaration of ‘strlen’
|| ||    23 | #include "../../include/mfb.h"
|| ||   +++ |+#include <string.h>
|| ||    24 | #include <stdio.h>

So a second pair of | is added. I don't really understand the format of the quickfix list, so this does not say anything to me. Apparently I'm doing something wrong, but what is that? What is the correct (and working) way of doing this?

1 Answer 1

2

Apparently I'm doing something wrong, but what is that?

You are not using :help :cfilter.

The quickfix window offers a high-level representation of the low-level quickfix list. You can think of it as one-way data binding, where creating a new list triggers a redraw of the window, which means that you need to change the underlying quickfix list in order to change what is displayed in the quickfix window.

This is typically done with :help getqflist(), :help setqflist(), and list manipulation functions (see :help list-functions), which is how the aforementioned :cfilter command is built.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.