Fork me on GitHub
#calva
<
2019-05-23
>
carmen19:05:22

Thought this might be useful for some people... Something I use in intellij/cursive is the ability to select an expression and hit one of (, [, { to wrap it. After wrapping the expression I don't want the selection anymore, so if I were wrapping (foo) then I would want to get ( | (foo)) where | would be my cursor. I was struggling to configure this in calva but eventually came to a solution. I updated all of the Paredit: Wrap Around ... commands so that their respective shortcuts are the wrappers themselves and updated the when clause to include editorHasSelection (otherwise I'd open a paren and the next expression would get slurped in).

carmen19:05:20

shortcuts window

carmen19:05:31

Keybindings

{
        "key": "shift+9",
        "command": "paredit.wrapAroundParens",
        "when": "editorTextFocus && editorHasSelection && !editorReadOnly && editorLangId =~ /clojure|scheme|lisp/ && paredit:keyMap =~ /original|strict/"
    },
    {
        "key": "[",
        "command": "paredit.wrapAroundSquare",
        "when": "editorHasSelection && editorTextFocus && !editorReadOnly && editorLangId =~ /clojure|scheme|lisp/ && paredit:keyMap =~ /original|strict/"
    },
    {
        "key": "shift+[",
        "command": "paredit.wrapAroundCurly",
        "when": "editorHasSelection && editorTextFocus && !editorReadOnly && editorLangId =~ /clojure|scheme|lisp/ && paredit:keyMap =~ /original|strict/"
    }

pez20:05:50

Thanks @carmen! Can you add that to the wiki? There’s a page there named Customize Calva or some such.

carmen20:05:19

sure!

❤️ 1
dabrazhe21:05:50

Has someone had some luck running Calva on Windows 10? I tried the developer release 2.0 on Win for kicks. It won's start jack-in, The project.clj is in the root folder of the proj (and starts on the Mac). Cannot find project, no project.clj, deps.edn or shadow-cljs.edn. (Boot projects are not supported by Jack-in yet. You'll need to start those manually, then connect Calva.

pez21:05:46

That looks similar to an issue reported…