Fork me on GitHub
#calva
<
2024-06-27
>
growthesque13:06:22

is there any reason why calva default ctrl + backspace or ctrl + delete behavior is to delete whole line and ctrl + shift + backspace deletes last s-exp and consumes everything between the cursor and the s-exp as well (like comments)? Coming from other IDEs where ctrl + backspace simply eats the last word whatever it is function, comment etc. this feels new. I know I can change it but just trying to understand the rationale of dealing with bigger units at the default. Do lispers feel the need to delete whole lines more often?

pez13:06:14

Those are not the Calva defaults. If you haven’t changed it, maybe some other extension is in play? See if it happens in, say, a JS file. Calva ships no default binding for ctrl+shift+backspace, iirc. The defaults for ctrl+backspace and ctrl+delete are to delete to the start or end of the current list, respectively. It’s part of the structural editing. See: https://calva.io/paredit/

growthesque13:06:45

sorry it's ctrl + alt + backspace, my bad.

growthesque13:06:56

can you recommend a different combo for barf than ctrl + shift + alt + <= because that actually moves vs code to another linux desktop on my system.

pez13:06:42

ctrl+alt+backspace deletes the previous sexpression, including anything in between there. The rationale is that it is the destructive equivalent to moving a sexpression backwards. Though that command actually is a bit more aware of comments. We should probably align them better.

growthesque13:06:45

something like ctrl + alt + , would be ideal because it's the opposite of slurp

pez13:06:56

ctrl+alt+, is the default on Linux.

growthesque13:06:44

oh nvm I mistook slurp backward for barf... sorry

growthesque13:06:10

i will experiment with paredit more before asking questions

pez13:06:33

Easy mistake. I never can learn the slurp and barf backwards commands.

growthesque13:06:25

hmm from what I can see slurp does generate a whitespace before the fn name and calva complains each time. are you supposed to del every time or is this something that has to be configured?

pez13:06:37

It makes sense to use ctrl+alt+shift+, and ctrl+alt+shift+. for slurpSexpBackward and barfSexpBackward, respectively on Linux, I think. Maybe we should change the Calva defaults to that…

growthesque13:06:06

i do enjoy using c+a+. and c+a+, for slurp and barf respectively to be honest.

growthesque13:06:35

4 key shortcuts feel like typing, lol 😄

pez13:06:42

It was for the backwards versions. You quickly run out of the shorter combos, and the rationale would be that shift reverses the direction.

pez14:06:12

That space can’t be configured away. It’s just have proven a bit tricky to get rid of. I hit tab if I don’t want it. What do you mean by “Calva complaining each time”? I see no complaints.

growthesque14:06:23

well maybe you clicked on Don't show again. I get this:

pez14:06:20

Hmm, I don’t think I’ve clicked that. Can you take me through the steps to reproduce it in a minimal file?

growthesque14:06:23

ok, after some more extensive testing this doesn't seem to be caused by slurping itself, but rather by where I was trying to slurp. to reproduce start a mini project, then write any function like (+ 1 2) and then right adjacent to it type any word, then go behind the word open parens and slurp, like this:

(ns minimal-clj.playground)

(+ 1 2)(slurp-here)word
I don't get a warning if the slurping is done on a new line on its own.

growthesque14:06:29

the problem occurs from creating a function that's not supposed to be there as far as I can tell, so actually it's supposed to work like that. you will get the warning even if you try to format it in other ways too.

pez14:06:18

I guess the warning makes more sense if you are making a conscious formatting, but when it is something as part of another command it gets confusing.

pez14:06:08

Anyway, that Don’t show again button is your friend here.

🙏 1
growthesque14:06:15

tbh it's mostly fine. if you read the error and think you will get what the problem is. it shouldn't be comfortable to make mistakes. (i think)

growthesque15:06:55

if you can figure out how to trim the space when slurping that would be pretty great, barf isn't producing spaces for some reason

pez15:06:57

In the situations where slurping produces that extra space, you can also try: 1. Expand selection 2. ( (or [ or whatever bracket Just FYI. This technique works pretty well in other languages as well.

growthesque15:06:24

This is a good one I used to highlight the word with the mouse before.

pez15:06:26

I think on Linux the default shortcut for expand selection is a bit hairy. On Mac it is ctrl+w.

growthesque15:06:19

it's not great: alt + shift + =>

growthesque15:06:03

now I get why people buy Macs. that extra keyboard button!

pez15:06:16

If you have a windows or linux-button on your machine, I think you can use it for bindings in VS Code. Not sure, though, just something I think I saw somewhere.

pez15:06:14

And, to not forget a third option. There are commands for wrapping the current form.

growthesque15:06:14

these look like tekken combos, lol