Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quickfix list, how to add and remove entries

Tags:

vim

In vim I ususally use the quickfix list as a type of todo list to fix errors or to refactor code. But I have a few problems in my workflow:

  • If I have to jump forward with :cn multiple times to compare others parts of the code, finding the last edited entry with :cp is difficult. :cw helps, but on bigger lists, it gets difficult, too. Removing fixed entries would be helpful.
  • On refactoring I encounter sometimes pieces of code I want to return later. Using global marks is ok, but adding the current position to the quickfix list would be more helpful.

So I hoped to find a simple command with :help quicktext to add a position to the quickfix list or to remove an already fixed entry. But all I could find is :cbuffer or :caddb. But on editing the buffer after :cw I get a message, it is not modifiable. The help text offers the following solution (but I do not really want to write temporary files):

Note: Making changes in the quickfix window has no effect on the list of errors. 'modifiable' is off to avoid making changes. If you delete or insert lines anyway, the relation between the text and the error number is messed up. If you really want to do this, you could write the contents of the quickfix window to a file and use ":cfile" to have it parsed and used as the new error list.

And maybe with :cad one could add the current line? Or has anyone an alternative workflow in mind?

like image 744
Trendfischer Avatar asked Mar 20 '17 13:03

Trendfischer


1 Answers

:set modifiable or :set ma makes the buffer modifiable so you can dd lines out of the quickfix list.

like image 163
Brian Di Palma Avatar answered Oct 09 '22 05:10

Brian Di Palma