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`.
seancorfield 2021-02-04T01:23:05.113400Z

(after grumbling the other day about how weird the Calva Paredit key bindings are and trying to customize it all back to what I was used it, I decided at lunchtime to revert to the default key bindings and just suffer through the learning period... and now I'm back to being fairly productive... but still having to mash undo frequently as I try several key chords before getting the right one! ๐Ÿ™‚ )

Cris B 2021-02-04T02:24:59.115700Z

Yes I've been through the keybindings shuffle a couple of times. I've settled on my own - Calva's seem to be nice & systematic but I can't quite get past the interference with common ones like ctrl + left/right arrows for wordwise cursor movement.

seancorfield 2021-02-04T03:18:14.119Z

@cb.lists Yeah, I think that was the one that caught me out late this afternoon after I'd been working with the default set for a few hours -- I was trying to move through a ;; line comment word-by-word and couldn't figure out how... But it seems like https://github.com/ailisp/strict-paredit-vscode uses ctrl + left/right for that and I still had wordwise cursor movement... so I think it was alt + left/right that was wordwise before. According to the keyboard shortcuts, alt + left/right is "Go Forward/Backward" with -- for "when" but...?

Cris B 2021-02-04T04:07:13.123700Z

@seancorfield That's go forward/back in the editor navigation history a la web browsers. Very useful so I leave as-is. As for ctrl + left/right, I've reset those back to the (pre-calva) default wordwise movements as they're too locked into muscle memory for me to want to relinquish. Also useful within clj/s files within line comments as you suggest.

seancorfield 2021-02-04T04:14:04.124600Z

Ah, right, Badly named then in VS Code ๐Ÿ™‚ I'll see how long I last with ctrl + left/right ๐Ÿ™‚

seancorfield 2021-02-04T04:20:14.125600Z

Yup, switching forward/backward sexp to alt-right/left is much more natural, and now I have forward/backward word with ctrl-right/left. Thanks @cb.lists

2
chucklehead 2021-02-04T04:53:11.129100Z

I've gotten pretty used to the Calva bindings on my laptop, but at my desk I use a Kinesis Advantage and there are several commands where I need to hit 3-4 buttons on one thumb cluster and I'm constantly short of thumbs - anyone have similar and figured out alternate keybindings that work well?

Cris B 2021-02-04T06:41:42.131Z

Love the new custom REPL command feature. tap> + Reveal invoked from a keyboard shortcut is very nice indeed.

๐Ÿค˜ 1
pez 2021-02-04T12:44:32.140Z

I want some help with testing a change to the custom REPL command feature. The main change is to enable binding keyboard shortcuts to the custom commands. (I also add built-in commands for tapping current and top-level form, so there will be no need to use the custom commands for that ๐Ÿ˜„.) Description of how it should work: https://github.com/BetterThanTomorrow/calva/issues/1011 VSIX: https://10836-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.159-1008-custom-snippets-shortcuts-b10c0624.vsix

โค๏ธ 2
lread 2021-02-04T13:42:01.142100Z

@chuck.cassel, I use a Kinesis Advantage too, Iโ€™m coming from spacemacs so am digging VSSpaceCode https://practicalli.github.io/clojure/clojure-editors/editor-install-guides/vspacecode-calva.html

Cris B 2021-02-04T21:02:53.142800Z

Both methods of binding a key to a custom command work for me, at least with a naรฏve test. One oddity - the binding for the last custom command in the json keybindings file shows up as the shortcut for the generic 'Calva: run custom REPL command' in the 'show all commands' popup.

Cris B 2021-02-04T21:08:25.143Z

The user can always copy the generic keybinding into their user keybinding json file and place that last I guess.

Cris B 2021-02-04T21:17:39.143200Z

One other thing - hitting 'ESC' when the custom REPL list (ctrl+alt+space) is up throws an error: "Cannot read property 'snippet' of undefined"

pez 2021-02-04T21:48:31.143500Z

Thanks! Found that last bug and fixed it in dev. Still figuring about what to do with that other thingโ€ฆ. And @brandon.ringe found a problem with running the commands when the cursor is in the output window.

1
pez 2021-02-04T22:08:28.146500Z

Iโ€™ve already gotten semi-used to the new slurp/barf keyboard shortcuts. Managed to destroy quite a bit of structure while learning, though. ctrl+alt+left/right for jumping past sexpressions was second nature, but nowโ€ฆ How are you other people faring with this?

Bees 2021-02-10T06:00:05.298600Z

I like how ctrl+left/right/up/down navigate. What I can't figure out is the new keys for the old behavior. After making navigation mistakes with the old keys I was finally adjusted how to work with paredit, then ctrl+left/right changed. ๐Ÿ˜•

Cris B 2021-02-04T22:28:07.147800Z

Can't help there as I've settled on my own shortcuts for the limited range of paredit ops I use.

seancorfield 2021-02-04T22:46:49.148600Z

@pez The biggest problem for me was figuring out exactly how to make this "do the right thing" on both Mac and Windows so that I don't lose word-wise navigation.

seancorfield 2021-02-04T22:47:17.148800Z

I ended up doing this: https://github.com/seancorfield/vscode-clover-setup/blob/develop/keybindings.json#L102-L141

seancorfield 2021-02-04T22:48:02.149900Z

On Mac I need alt+right / alt+left for word-wise nav. On Windows I need ctrl+right / ctrl-left for word-wise nav.

pez 2021-02-04T22:48:57.151400Z

There are win and mac fields you can use in addition to key. Have you tried that?

seancorfield 2021-02-04T22:49:08.151600Z

(it's annoying to have to switch keys between Mac/Windows for word-wise nav but much more annoying to have Calva's paredit usurp one set of those keys differently!)

seancorfield 2021-02-04T22:49:30.152500Z

I hadn't found win/`mac` in the VS Code docs but I found isMac ๐Ÿ™‚

pez 2021-02-04T22:49:58.153100Z

The new default keybindings leave word-wise navigation alone for the respective platform.

pez 2021-02-04T22:50:22.153900Z

So you might get away with removing your custom bindings.

seancorfield 2021-02-04T22:50:45.154500Z

The default settings just didn't work for me.

seancorfield 2021-02-04T22:51:41.155600Z

Other than backward/forward sexp, the other key bindings are fine. Well, I'm getting used to them but they're not un-fine.

pez 2021-02-04T22:52:02.156100Z

Would a context variable like calva:inComment help?

seancorfield 2021-02-04T22:53:03.156800Z

I don't want that nav to be different in different parts of the file.

pez 2021-02-04T22:54:14.157700Z

Do you ever use word navigation in sexpressions?

seancorfield 2021-02-04T22:55:49.159200Z

Yes, all the time ๐Ÿ™‚

pez 2021-02-04T22:56:11.159700Z

I move by sexpressions there. But in comments there are no sexpressions so I would be fine if the forward/backward sexpr commands moved by words there.

pez 2021-02-04T22:58:04.161Z

Can you give me an example when you move by word in sexpressions?

seancorfield 2021-02-04T22:58:47.161500Z

What do you mean? Word-by-word is word-by-word.

pez 2021-02-04T23:00:18.163Z

Well, depends. ๐Ÿ˜ƒ What are the words in (defn foo [a b] :bar)?

seancorfield 2021-02-04T23:01:06.163500Z

With the ; that isn't legal Clojure as it stands -- is that what you meant?

pez 2021-02-04T23:01:21.163800Z

Fixed ๐Ÿ˜ƒ

seancorfield 2021-02-04T23:03:21.165400Z

|(defn foo [a b] :bar)
 (defn| foo [a b] :bar)
 (defn foo| [a b] :bar)
 (defn foo [a| b] :bar)
 (defn foo [a b|] :bar)
 (defn foo [a b]| :bar)
 (defn foo [a b] :bar|)
 (defn foo [a b] :bar)|

borkdude 2021-02-04T23:03:42.165700Z

One thing I miss in Calva when I'm using it is that paredit doesn't work in strings like "(foo (bar (baz)))". I use this quite a lot in emacs

seancorfield 2021-02-04T23:05:20.167Z

(and, to be clear, I don't care that going backwards word-wise through that code doesn't use the same cursor positions -- it's "close enough" to words for fast navigation where I don't have to switch key chords in the middle of an action)

pez 2021-02-04T23:06:26.167800Z

Thanks. Is there even a command that would move the cursor like that?

seancorfield 2021-02-04T23:07:36.168600Z

Who is that question addressed at?

pez 2021-02-04T23:07:48.168900Z

To you. ๐Ÿ˜ƒ

pez 2021-02-04T23:11:29.169400Z

Found it. cursorWordRight.

pez 2021-02-04T23:22:10.171800Z

@seancorfield So then maybe these settings could work for you?

{
        "key": "ctrl+right",
        "win": "ctrl+right",
        "mac": "alt+right",
        "command": "cursorWordRight"
    },
    {
        "key": "ctrl+left",
        "win": "ctrl+left",
        "mac": "alt+left",
        "command": "cursorWordLeft"
    },
    {
        "key": "ctrl+right",
        "mac": "ctrl+right",
        "win": "alt+right",
        "command": "paredit.forwardSexp",
        "when": "calva:keybindingsEnabled && editorTextFocus && editorLangId == 'clojure' && paredit:keyMap =~ /original|strict/"
    },
    {
        "key": "ctrl+left",
        "mac": "ctrl+left",
        "win": "alt+left",
        "command": "paredit.backwardSexp",
        "when": "calva:keybindingsEnabled && editorTextFocus && editorLangId == 'clojure' && paredit:keyMap =~ /original|strict/"
    }

pez 2021-02-04T23:25:28.172900Z

Not sure if key is needed in any of them. The schema complained if I omitted them. ๐Ÿ˜ƒ

bringe 2021-02-04T23:31:01.174700Z

Welcome @brdloush!

๐Ÿ‘‹ 1
pez 2021-02-04T23:33:03.176400Z

This VSIX has some fixes for the new keyboard shortcuts enabled custom REPL commands. Could you take it for a spin, @cb.lists, @janne.sauvala? (And anyone else of course,) https://10856-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.159-dev-b89d4952.vsix

seancorfield 2021-02-05T17:47:25.191Z

Nice! The latest Reveal is 1.3.194 I think. Big changes in 1.3: the ability to send forms to Reveal that control the UI, open new views etc.

pez 2021-02-05T17:52:29.191500Z

Thanks for that info!

pez 2021-02-04T23:35:14.179Z

Issue https://github.com/BetterThanTomorrow/calva/issues/1011 has the documentation for how it should work. If you find typos and strange things there, please comment on the issue.

Tomas Brejla 2021-02-04T23:37:04.181700Z

Seems that I arrived in perfect time ๐Ÿ˜„ I'm having issues on my calva v2.0.158 with custom commands. Will try this vsix, hopefully it will resolve it ๐Ÿ™‚

pez 2021-02-04T23:37:42.182800Z

What issues, if I may be curious? ๐Ÿ˜ƒ

Janne Sauvala 2021-02-04T23:37:47.183Z

Will do! One thing I was trying to do was to create fairly complex custom snipped to launch Reveal from the REPL. The command is taken from Seanโ€™s settings and I have used it previously only from inside comment-block. There was something funny happening when I was trying to execute the command. Iโ€™ll use this newer version and continue debugging

pez 2021-02-04T23:38:46.183200Z

Cool. I launch Reveal as part of repl start, btw.

seancorfield 2021-02-04T23:39:03.183400Z

That seems cleaner than what I have so I'll take that for a spin shortly. Thanks.

pez 2021-02-04T23:41:14.183600Z

If it works, we can add it to the http://calva.io

Cris B 2021-02-04T23:41:25.183800Z

Working thus far for my (very vanilla) test cases.

โค๏ธ 1
Tomas Brejla 2021-02-04T23:41:59.184100Z

The commands do not get executed for me at all. Even trivial ones such as

"calva.customREPLCommandSnippets": [
        {
            "name": "Printout test",
            "snippet": "(println 42)",
            "repl": "clj"
        },
    ],
I can see the command in the popup window, but when I select it, just the empty line gets added to output.calva-replwindow. What's even more strange.. it happened once or twice tonight that it was working just fine for a while. I wonder whether it might be caused by some namespace reloading stuff I'm using in my project (integrant-repl and thus tools.namespace)

pez 2021-02-04T23:44:40.184300Z

I donโ€™t think that could be the reason. The snippet should be printed to the repl windowโ€ฆ What system are you on?

Tomas Brejla 2021-02-04T23:45:30.184500Z

โžœ  emptyproj cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.10
DISTRIB_CODENAME=groovy
DISTRIB_DESCRIPTION="Ubuntu 20.10"
โžœ  emptyproj uname -a            
Linux brdloush-nb 5.8.0-41-generic #46-Ubuntu SMP Mon Jan 18 16:48:44 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

pez 2021-02-04T23:46:23.184800Z

Try without the repl property. Donโ€™t think that could be it, but anyway.

Tomas Brejla 2021-02-04T23:46:52.185Z

I tried killing all my vs code windows, then created empty lein new emptyproj project. Cider jack in, tried the Printout test.. didn't work. Upgraded to the VSIX version, reloaded plugin... cider jack in... and it seems to work.

Tomas Brejla 2021-02-04T23:47:04.185200Z

might be just a coincidence though

Tomas Brejla 2021-02-04T23:49:02.185400Z

switched back to my original project, custom commands still seem to work

pez 2021-02-04T23:49:18.185600Z

The VSIX version is quite a major change from the currently released one, so it might have done away with that particular problem. (Probably introduced some new problems, but hopefully on an evolved level, if so. ๐Ÿ˜„)

๐Ÿ˜€ 1
Tomas Brejla 2021-02-04T23:49:27.185800Z

perhaps reloading the plugin somehow flushed some broken caches or something? :man-shrugging:

pez 2021-02-04T23:50:48.186100Z

letโ€™s hope weโ€™ll never see it again, haha. ยฏ\(ใƒ„)/ยฏ

seancorfield 2021-02-04T23:53:00.186300Z

I decided to change it to the mac bindings even on Windows. My problem before was not knowing the cursorWordRight/`Left` commands so I didn't know how to force those to the alt versions!

seancorfield 2021-02-04T23:53:48.186500Z

It's a win for me since I now have the exact same key bindings on Mac and Windows: ctrl right/left for sexp nav; alt right/left for word nav.

seancorfield 2021-02-04T23:54:19.186700Z

{
      "key": "ctrl+right",
      "command": "paredit.forwardSexp",
      "when": "calva:keybindingsEnabled && editorTextFocus && editorLangId == 'clojure' && paredit:keyMap =~ /original|strict/"
    },
    {
      "key": "alt+right",
      "command": "cursorWordRight"
    },
    {
      "key": "ctrl+left",
      "command": "paredit.backwardSexp",
      "when": "calva:keybindingsEnabled && editorTextFocus && editorLangId == 'clojure' && paredit:keyMap =~ /original|strict/"
    },
    {
      "key": "alt+left",
      "command": "cursorWordLeft"
    }

seancorfield 2021-02-04T23:55:26.186900Z

(but your suggestion did work in terms of fixing the keys per-platform, as you expected -- I'd just rather have them be identical across platforms, instead of swapped across platforms)

๐Ÿ‘ 1
pez 2021-02-04T23:55:50.187100Z

Awesome. We used to have the same bindings for defaults, but it caused troubles, so now we have some few defaults where it differs between mac and win. Makes total sense to use the same ones if you switch back and forth.

seancorfield 2021-02-04T23:56:44.187400Z

At some point I'll replace my Mac with a Windows desktop and maybe then I'll remove this and learn the platform defaults ๐Ÿ™‚

seancorfield 2021-02-04T23:57:02.187600Z

(but I'm on the Mac slightly more than Windows at the moment)

pez 2021-02-04T23:58:01.187800Z

I only use Windows when I test how Calva things work there. ๐Ÿ˜ƒ