Fork me on GitHub
#cursive
<
2024-01-07
>
Aron16:01:24

how to fix them

kennytilton22:01:36

How exactly are they broken?

Aron22:01:25

they are not balanced

Aron22:01:45

i mean, i can balance them by undoing, or by commenting out and then inserting, but i figured, maybe there are better ways

Aron22:01:01

and yes, i know the idea is not to have them imbalanced but it's so easy to get there

kennytilton22:01:55

First, keep an eye on them when closing parens, make sure we do not do too many or too few. Rely on indentation as we type. That tells us when we are off a little. option-cmd-L reindents after a lot of code juggling. Make sure the result is what we expect. Oh, when closing a parens, keep an eye on the status line showing what we just closed. I am NOT a fan, but some like Paredit or Parinfer. Bit of a learning curve there. Finally, walk out ) by ) to see what is being balanced. Most of all, give it time. It will be second nature in a month.

Aron22:01:39

that's not how it happens though

Aron22:01:02

been doing coding for couple decades now, some things are deeper than second nature

Aron22:01:28

i cut a lot of code by selecting lines, if the parens are imbalanced per line, which they often are, it happens

kennytilton22:01:17

Forget line-based in the land of parens. In a Lisp we edit more sensibly, in units of "forms" or expressions. Double-click a parens to grab the whole thing.

Aron22:01:35

I don't want the whole thing 😄

Aron23:01:48

If the whole thing was what I needed, I wouldn't want to cut it

kennytilton23:01:59

No Lisp for you! :rolling_on_the_floor_laughing:

kennytilton23:01:14

Seinfeld reference ^^^

Aron23:01:23

never watched the show:)

kennytilton23:01:42

You can double-click any expr.

kennytilton23:01:10

I never watched Seinfeld. But I know about "The Soup Nazi".

Aron23:01:17

will have to try, but again, I emphasize, that I want only part of the expression

Aron23:01:26

I don't know about the soup nazi either

kennytilton23:01:56

Show some text, plz. btw, nice to meet someone who hates typing more than I.

Aron23:01:07

it's muscle memory to select a line, cut it and the paste it and remove what is not needed

kennytilton23:01:53

It is harder for good programmers to learn new editing than to learn new languages.

💯 1
Aron23:01:56

in vim it's even easier, just dd

Aron23:01:14

old programmer not good programmer in my case, but yea

Aron23:01:49

is there a keyboard shortcut for this double click thing

kennytilton23:01:03

It is funny, I started doing live coding videos and after a decade of using Cursive decided I should learn some keychords. Wow! And these are not Parinfer/Paredit, which is what fooled me. Let me know if you find any good ones.

Aron23:01:57

ctrl+w and ctrl+shift+w is what I need it seems

kennytilton23:01:24

Under the top-level "Edit" menu look all the way down to "Structural Editing". Learn one new one over coffee every morning. 🙂

Aron23:01:27

seems like IDEA shortcut, not related to cursive which threw me off

Aron23:01:58

nah, coffee is for later in the day, can't start the day with the coffee because then the crash coincides with food coma from lunch

kennytilton23:01:03

You seem to have worked out your coffee drill in more detail than I. 👏

Aron23:01:19

been drinking coffee for almost a decade longer than coding 😅 maybe in seven years i figure out my coding drill details too 😄

kennytilton23:01:55

I adhere to the macrobiotic principle: when I crash, I crawl back into bed. On-site, I sleep in my chair. They hate that.

kennytilton23:01:56

I got quite a kick out of vi during a brief encounter. Could easily win me over from keychords. But as a wise language inventor once said, programming is not about typing, so I just get on with it.

kennytilton23:01:23

btw, ^X deletes a line, ^D duplicates one.

🤯 1
cfleming00:01:08

If you want to cut and paste lines and have the parens automatically fixed up, parinfer is what you want. I use it myself, and I think it’s pretty great. Enable it at Settings | Editor | General | Smart Keys | Clojure.

3
cfleming00:01:32

I don’t have any documentation about it unfortunately, the OG website is here: https://shaunlebron.github.io/parinfer/, but the version in Cursive uses what’s called Smart Mode, which blends paren and indent modes. So, it should just do The Right Thing.

cfleming00:01:57

If you like vim, then IdeaVim is good too, by all accounts, I don’t use it myself.

cfleming00:01:12

Selection expansion (which I think you were asking about) is here: https://cursive-ide.com/userguide/paredit.html#selecting-things

Aron00:01:12

thanks, will try

Aron00:01:51

I had it in vim, but it always ruined undo, had to turn it off and back every fifteen minutes