vim-qf
vim-qf copied to clipboard
[feature] Allow Keep and Reject operate on ranges (Visual Selection)
Hi. My use case is that I often filter out certain entries from quickfix window to reduce the scope. Even though Keep and Reject currently do the job, I believe it could be a bit more convenient to support exclusion (and inclusion) of results by visually selecting them (line selection) and calling Reject (or Keep) on the selected range. Could you please implement that? Thank you!
This is a very reasonable request and I already have all the necessary bits and pieces. I'll look into it
Please checkout the latest commit.
Thanks! I've tried your changes and I'm afraid there are still some rough edges...
- When visual selection spans multiple filenames OR when only one line across many with the same filename is selected, and Reject is called.
- Basically the same cases but with Keep.
Yeah, my initial assumption is that the user visually selects a word or parts of a word. Does it really make sense to visually select multiple lines?
Hmm… I see now that I may have misread your request. Something like :5,8Keep
actually makes a lot of sense. Back to the drawing board!
You mean that if you select a word, it's sent to Keep/Reject as an argument? Hmm, to be honest, never thought of that, but I think it's also reasonable and convenient.
As for multiple lines, sure, it makes sense. Before you explained your vision, only multiple line selection made sense to me when I created this request. It's just that I prefer to manually select lines that I want to keep/get rid of. Thus, my selection should not be treated as a pattern, just as a range. I guess vim plugin can differentiate between line and word selection? If it's a word selection, the old logic applies, if it's a line selection, the lines in the range should be removed/kept. That was my intuition and anticipation when I tried to use Keep/Reject on a block of lines.
OK, now that it's clear I can move forward.
It has been a while and I apologise for the delay.
I just pushed range support for :Keep
and :Reject
.
You can now do :.Reject
to remove the currently selected entry or :10,15Reject
to remove entries 10-15. Same for :Keep
.
Happy to get any feedback.