This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (5)
- # babashka (1)
- # beginners (140)
- # braveandtrue (1)
- # calva (28)
- # chlorine-clover (39)
- # cider (8)
- # clj-kondo (1)
- # cljfx (15)
- # cljs-dev (2)
- # clojure (41)
- # clojure-europe (39)
- # clojure-france (3)
- # clojure-germany (5)
- # clojurescript (28)
- # clr (1)
- # css (1)
- # cursive (3)
- # data-science (19)
- # fulcro (14)
- # graalvm (3)
- # hoplon (18)
- # jobs (2)
- # malli (7)
- # meander (2)
- # off-topic (10)
- # pathom (6)
- # re-frame (3)
- # reagent (2)
- # remote-jobs (1)
- # reveal (1)
- # shadow-cljs (5)
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?
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.
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
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
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
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.
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.
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.
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])
Cursor is now at |, which is on a new line, but still enclosed in the same form as before.
(let [k1 v1 |])
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.
OK, that's good to know. I'll play around more before deciding if I really want something like that or not.
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.
So appears the correct sequence to do this OOB is paredit.forwardUpSexp (Ctrl+Alt+Down) then Enter
That would result in
… I think.Forward to List End/Close (`ctrlt+end`), then
(let [k1 v1] |)
I think there might be some extension that lets you compose commands and bind to shortcuts.
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.
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.
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.
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
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.