zop-to-char icon indicating copy to clipboard operation
zop-to-char copied to clipboard

Binding to toggle between 'to-char' and 'up-to-char' behavior

Open glucas opened this issue 8 years ago • 4 comments

It would be convenient to have a binding from the zop-to-char input loop to toggle between zapping the target character and only zapping up to the target character. This would allow for both zop-to-char and zop-up-to-char behavior with a single global binding.

For example, bind C-SPC to a new zop-toggle-include-target-char command. Then I could always start with M-z <char> and hit C-SPC if I decide to keep the target char as is.

glucas avatar Jul 28 '15 15:07 glucas

I'm not sure it would be convenient. People usually use only zap-to-char or zap-up-to-char and it becomes part of their mental model what this "zap" command does. The thing you propose would require more mental energy to operate it with little benefit. IMHO.

mrkkrp avatar Aug 30 '15 17:08 mrkkrp

I could be an edge case, then. Personally I often find myself wanting both variants. I think the interactive-with-feedback approach of zop would make it more intuitive than having two separate bindings (e.g. having to remember which variant I bound with a 'z' vs. 'Z', or whatever).

glucas avatar Aug 31 '15 14:08 glucas

@glucas have you implement it yourself? I don't know-how could do that, if so, please share, or else until someday I implement it would post that code here.

snowman avatar Oct 12 '20 09:10 snowman

snowman [email protected] writes:

@glucas have you implement it yourself? I don't know-how could do that, if so, please share, or else until someday I implement it would pose the code here.

  1. Create a var with a key as value
  2. When user hit this key (compare input with var value) do (setq zop-to-char--delete-up-to-char (not zop-to-char--delete-up-to-char))

-- Thierry

thierryvolpiatto avatar Oct 12 '20 15:10 thierryvolpiatto