calva icon indicating copy to clipboard operation
calva copied to clipboard

Add "Cycle collection kind" command

Open gerdint opened this issue 1 year ago • 6 comments

It is often handy to change the kind of balanced brackets you are working with, i.e. (foo bar) => [foo bar]. Some Clojure editors have such a command. Typical candidates are: () => [] => {} => #{} (and then back over again). Should work on the expression's closest enclosing brackets

gerdint avatar Mar 25 '24 15:03 gerdint

Would be nice. So far we have rewrap-commands, but maybe some people find it easier with a single command.

image

PEZ avatar Mar 25 '24 17:03 PEZ

Ah, I was not aware of the rewrap commands! I actually think that may be a better option. The only (but big) upside of a single command that is that you only need to bind (and remember) a single key. What is the rationale for "H" for the set?

gerdint avatar Mar 25 '24 19:03 gerdint

Since the cycle command can be expressed in terms of these commands, I think it is reasonable easy to implement.

What is the rationale for "H" for the set?

Hash-sign 😄

PEZ avatar Mar 25 '24 19:03 PEZ

Roger. I would perhaps prefer semantic keys, i.e 'm' for "map", 'v' fo "vector" etc, but nothing I can't tweak myself! But I think it would make sense to use a prefix key and a single un-chorded second key (like for the ctrl-alt-space prefix for the custom repl commands), i.e: "Ctrl-alt-r p" for "Rewrap ()". Or any particular reason this is not the currently the case?

gerdint avatar Mar 26 '24 15:03 gerdint

Semantic mnemonics would have made perfect sense. Too late now, I'm afraid.

As for why not ctrl+alt+r p. Iirc, we had something else bound to that. It's also very easy to type. Hold down ctrl+alt, type r p.

PEZ avatar Mar 26 '24 15:03 PEZ

Well, if you have an ergonomic keyboard with all modifers on your thumbs (a Kinesis advantage in my case) and a layout where 'r' and 'p' are on different hands (Dvorak layout in my case, but same for Qwerty in this case) it's less easy to type because you need to switch hands for the modifers! :) Come to think of it, that's probably why I find multi-stroke chorded key bindings onerous, unless you are lucky and there happens to be no hand-switching involved.

I understand it's hard to please everyone and that's why keybindings are customizable, but this is why something like "ctrl+alt+r p" is more convenient in my opinion.

gerdint avatar Mar 27 '24 07:03 gerdint