calva

Wednesdays you might find @U0ETXRFEW in the Gather Calva space. Invite is https://gather.town/invite?token=GZqrm7CR and the password is `Be kind`.
practicalli-john 2021-01-02T00:16:20.082600Z

This looks really useful, thanks. Is there a way in VS Code command pallet to show all the Calva related functions?

bringe 2021-01-02T00:34:22.082800Z

Ah, yeah definitely seems like some environment issue

practicalli-john 2021-01-02T03:55:24.083Z

I have some of the most useful key bindings added to vspacecode and they seem to work very well. There are lots of useful key bindings in the Evaluation sub-menu There are still quite a few key bindings to add (I had forgotten how tedious and error prone writing json can be). I've only needed to over-ride the Calva escape key binding with space+escape . I've added a , e l key binding to clear all evaluations as well

slipset 2021-01-02T13:16:53.085700Z

In Cider I can press C-c C-z (I believe) to jump between the repl and the current source file. Any such thing in Calva?

pez 2021-01-02T13:19:46.088200Z

Currently only in one direction (from editor file to repl) , but I added something yesterday that should make the other direction easy to fix. I believe there is an old issue about this on Github, but if not, I’d welcome you to add one. I’ll add it in my last winter-leave Calva time. It is long overdue.

slipset 2021-01-02T13:29:14.088400Z

https://github.com/BetterThanTomorrow/calva/issues/920

❤️ 1
pez 2021-01-02T18:10:02.089100Z

Here’s a VSIX build where there is a command for opening a file for the current active repl window namespace. Default binding is ctrl+alt+c o, same as for revealing the output/repl window/file. https://9671-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.145-920-switch-to-editor-for-ns-7996cfb3.vsix

slipset 2021-01-02T20:51:28.090Z

🙏

ajoberstar 2021-01-02T21:03:21.092300Z

Is there a Calva command for newline inside current form? I'm trying to get something that feels equivalent to the normal Ctrl+Enter behavior of VS Code (add a newline after the current line). For the purposes of Clojure code it would be nice to stay in the current form. So would be something like this:

(let [k1 |v2])
;; Ctrl+Enter at the |
(let [k1 v2
      |])
;; cursor is at pipe

pez 2021-01-02T21:34:59.093100Z

Not sure I follow. What should happen?

ajoberstar 2021-01-02T21:36:46.094600Z

Right now, it does something like:

(let [k1 |v2])
;; Ctrl+Enter when cursor is at |
(let [k1 v2])
|
;; Cursor goes to start of a newline

ajoberstar 2021-01-02T21:37:28.095400Z

Basically, I'm still trying to get the hang of Paredit and was hoping to find some key bindings that can feel more like the commands that are native in VS Code.

ajoberstar 2021-01-02T21:38:06.096300Z

I think in Parinfer, I get the behavior I showed in the first snippet, but I've been running into bugs with it, so I was going to give up and try Paredit again.

pez 2021-01-02T21:39:59.098700Z

I think I need to first figure out if that first snippet is a before or after picture. 😀 Jokes aside, I need to see what it looks like before and what it looks like after the command is issued.

ajoberstar 2021-01-02T21:42:07.100900Z

Sorry, now I see where the confusion is. The first snippet is a before and after. I'll try to break it apart more: Before: (cursor position at |)

(let [k1 |v1])
After: (Ctrl+Enter)
(let [k1 v1
      |])
Cursor is now at |, which is on a new line, but still enclosed in the same form as before.

pez 2021-01-02T21:44:16.102600Z

Interesting. I have so many questions. But also an answer, this command does not exist yet. But I think it would be fun to add it. If you want to do it, I’d be happy to assist.

🙏 1
ajoberstar 2021-01-02T21:45:14.103200Z

OK, that's good to know. I'll play around more before deciding if I really want something like that or not.

ajoberstar 2021-01-02T21:46:08.104300Z

Main issue for me is being used to non-structural editing (and in Clojure using Parinfer before). I'm more used to VS Code's traditional navigation and editing bindings. Default behavior of Calva has thrown me for a loop. But I think it's just something I need to practice more.

ajoberstar 2021-01-02T22:08:22.105Z

So appears the correct sequence to do this OOB is paredit.forwardUpSexp (Ctrl+Alt+Down) then Enter

pez 2021-01-02T22:23:03.107400Z

That would result in

(let [k1 v1]
 |)
… I think.Forward to List End/Close (`ctrlt+end`), then enter.

ajoberstar 2021-01-02T22:23:20.107700Z

Ah, yes good catch. Thanks again!

pez 2021-01-02T22:24:49.108700Z

I think there might be some extension that lets you compose commands and bind to shortcuts.

pez 2021-01-02T22:27:32.110100Z

I’m still a bit confused about the “normal” behaviour of ctrl+enter. On my machine that isn’t bound to anything in the editor.

ajoberstar 2021-01-02T22:27:57.110500Z

I'm on Windows, which could be the difference

ajoberstar 2021-01-02T22:28:44.110800Z

"Insert Line Below" is the command it's bound to

pez 2021-01-02T22:33:19.113900Z

Ah, yes, that’s cmd+enter on mac. Never used it, even though o is in my synapses when using Vim. I think your mapping of that to structural is nice. If it wasn’t that we want the evaluation commands to be super accessible, I think it would make total sense to bind like you are thinking there.

ajoberstar 2021-01-02T22:36:40.116700Z

Maybe platform differences are part of my troubles. At least from the standpoint of a Windows VS Code user, a lot of the default bindings have surprising behavior to me. e.g. Ctrl+Left/Ctrl+Right are by default move forward/backward by word. Whereas in Calva they default to paredit.barfForward and paredit.slurpForward. I expected navigation rather than editing commands for those shortcuts.

pez 2021-01-02T22:39:28.118300Z

Yes, we have been optimising for using the same shortcuts cross-platform, but have started to regret that a bit. And ctrl+left/rightisn’t even very available on Mac… https://calva.io/quirks/#macos-and-the-slurp-and-barf-keyboard-shortcuts

ajoberstar 2021-01-02T22:40:59.119700Z

I'm sure bindings are something where you'll never please anyone too. I'm going to keep trying to familiarize myself with the commands and see if I end up finding some bindings that feel more natural for me.

ajoberstar 2021-01-02T22:41:18.120200Z

I appreciate the help!

pez 2021-01-02T22:44:27.122800Z

I appreciate the feedback and reminder to revisit the current setup for this. VS Code (probably guided by prior art) has decided to differentiate, and I think Calva should probably follow in those steps.

👍 1