Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Allow Keep and Reject operate on ranges (Visual Selection) #72

Open
balta2ar opened this issue Apr 28, 2018 · 7 comments
Open

Comments

@balta2ar
Copy link

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!

@romainl
Copy link
Owner

romainl commented Apr 28, 2018

This is a very reasonable request and I already have all the necessary bits and pieces. I'll look into it

@romainl romainl reopened this Apr 29, 2018
@romainl
Copy link
Owner

romainl commented Apr 29, 2018

Please checkout the latest commit.

@balta2ar
Copy link
Author

Thanks! I've tried your changes and I'm afraid there are still some rough edges...

  1. When visual selection spans multiple filenames OR when only one line across many with the same filename is selected, and Reject is called.

vim-qf-reject-one-line-of-many-or-spans-different-files

  1. Basically the same cases but with Keep.

vim-qf-keep-spans-many

@romainl
Copy link
Owner

romainl commented Apr 29, 2018

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!

@balta2ar
Copy link
Author

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.

@romainl
Copy link
Owner

romainl commented Apr 29, 2018

OK, now that it's clear I can move forward.

@romainl
Copy link
Owner

romainl commented Mar 28, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants