Closed eflanigan00 closed 6 years ago
Thanks, let me know what you think about the added one.
If there's nice a use case for the other one, I'll add it later, but I'd like to keep things simple.
The added one works, thanks for adding it. I really think we need both.
When I'm deleting backward I use zap-to-char (includes the character I'm deleting).
When I'm deleting forward I use zap-up-to-char (doesn't include the character)
Examples below:
My cursor is at C and I use zap-up-to-char to delete up to the word (including the whitespace) but not including the word. In the example I'm deleting up to description (but not including)
This is my sentence and Cthere is some description
Results in
This is my sentence and description
my cursor is at C then I use zap-to-char to delete This (including)
This is my sentence and Cthere is some description
Results in
there is some description
If I had to pick only one I would prefer to have zap-up-to-char because of how I navigate files and edit. But that will vary depending on the user.
Another use case for zap-up-to-char is when using avy-goto-line. The current implementation deletes the first character of the line the user specifies. I would imagine that zap-up-to-char wouldn't have this problem.
@abo-abo can you please add the other one also based on my comments above?
Will do. Is there a way to merge the two commands into one?
I'm not sure. It is really 5 or 6 lines or code and to me having both makes sense but I could be overlooking something.
overlooking something
We should try not to overlook the opportunity to simplify things. If one new command does the job of two old commands, it's a win.
For instance, you say:
So why not unify them into a single command-3 that uses the command-1 logic if the target is after the point and command-2 logic otherwise.
I really like your design approach to this @abo-abo. You make great points. And I love the idea of a unified command. It simplifies the user interface and makes us all more efficient editors.
I would really like this new command to work well with avy-goto-line because I think that is a really powerful utility when paired with the avy actions. It seems your proposed command-3 will work for the goto-line case also.
@abo-abo would you be able to make this update easily?
Hi, sorry for the late response, I've had other things piling up. I'm coming back from vacation next week, I'll try to figure out this feature soon.
No problem take your time. I hope you had a great vacation!
@abo-abo any chance you can add this feature?
Sorry delaying. Yes, I'll add it eventually. But if I don't manage before this Friday, you'll have to wait until June; I have one more vacation coming up:)
OK, I've made a small modification that results in both of your use cases working. See also the commit message.
If you have more use cases that don't work currently, please open a new issue.
This is amazing, thank you so much. Have a great second vacation, you deserve it!!
Similar to zap-to-char but with the ability to trigger off avy action
zap-up-to-char doesn't include the entered char zap-to-char does include the entered char
Binding is flexible but these might work: avy-action-zap-up-to-char bind to 'z' avy-action-zap-to-char bind to 'Z'