Fork me on GitHub
#calva
<
2024-04-29
>
p-himik16:04:25

A question about Paredit + Vim (via Neovim in my case, if that's important) and Calva. Suppose I have this code:

(expression  (sdf|sd) "asdfsd" ) ;; comment
with the text cursor being where the | is. In regular Vim, pressing shift+d would then turn it into (expression (sdf, thus breaking the balance. Apparently, Vim + Fireplace would result in (expression (sdf)). Is there some way this could work in Cursive as well? I tried looking in the settings but couldn't find anything.

pez16:04:01

I don’t know anything about how Vim or Neovim works with VS Code. But I imagine it would be a matter f mapping D to a Paredit command. However, there is no Paredit command like that in Calva, so I think that means “no” to the question.

pez16:04:23

Closest equivalent I can think of is Paredit Kill Forwards. It would result in

(expression  (sdf|) "asdfsd" ) ;; comment
Then it would refuse to delete anything more. And you could do forward down and then kill forward again.
(expression  (sdf)|) ;; comment
And once more to kill the comment.

👍 1
pez16:04:32

Would be interesting to learn about why/when it makes sense to delete like that. I don’t think it’s super hard to implement.

p-himik16:04:47

It's just my curiosity. :) Prompted by learning what Fireplace does in that case. I was certain that at some point I saw a setting like "perform all the edit actions without making parens unbalanced", but I've probably hallucinated it. And I also occasionally do mess up the balancing because of how Vim works. Trivial to fix of course, but that still got me curious about possibilities out there.

pez16:04:27

Calva has a command for healing the structure using the indentation. So in theory it could be a matter of stringing together the raw D command with Infer parens. But only in theory, because the infer command is a bit dangerous, operating on the whole file, and out of sight something may not be properly indented…

👍 1
Vladimir Pouzanov17:04:57

is there any way to disable "Welcome to Calva" thing? my sidebar is usually collapsed and it shows up on every launch of a clojure project.

pez18:04:03

You mean the output channel? Look for “Calva says” in settings.

Vladimir Pouzanov18:04:36

bummer. I thought I did that before. Thanks!

🙏 1