Fork me on GitHub
#calva
<
2020-04-12
>
slawek09805:04:31

Yes, but then I canโ€™t type โ€œฤ‡โ€ when writing markdown document, for example. They problem is I actually need AltGr.

slawek09806:04:42

What I need for special chars is AltGr but not Ctrl+Alt.

hindol.adhya07:04:26

There must be a tool for remapping keys.

pez08:04:55

Being unaware of such a tool, I've made a remapping in this gist: https://gist.github.com/PEZ/3fc22e015e0d33fb9b73074fd6abf292

pez08:04:30

@slawek098 Can you try that and let us know if it works for you? It will be a bit of a bother for you to keep it in sync as Calva changes, but it is all I can think of right now, short of changing all these in Calva. We have done that before, several times, but we never seem to find anything that is safe from Windows crazyness.

slawek09808:04:37

@pez I've temporarily switched to US keylayout just in VSCode window.

slawek09808:04:45

But it's really infuriating.

pez09:04:17

Check that gist out instead, me thinks. ๐Ÿ˜Ž

ceronman09:04:05

Hi everyone! Clojure newbie here! Loving it and also Calva ๐Ÿ˜„ I have a first small question, is it possible to hide/remove the help section of the repl window:

pez09:04:21

This is the only way:

ceronman10:04:50

I guess it works ๐Ÿ˜„

ceronman10:04:15

Another quick one, is there a key shortcut to quickly switch focus between editor and repl window?

pez10:04:52

There should be. But VS Code has commands for switching between windows. On My Mac I can press cmd+alt+left/right to traverse between editors, including the REPL window.

pez10:04:31

That said. Since you advertise as a beginner, my advice is to use the REPL window as little as possible. This for two reasons: 1. The habit of using top level evaluations withing (comment ...) blocks directly in your files is much more flexible. 2. The REPL window sucks a bit.

ceronman10:04:20

Thanks for the advice. I try to evaluate directly in the editor as much as possible, but sometimes when the output is large, it's not very practical.

ceronman10:04:28

so it's handy to evaluate in the repl window

hindol.adhya10:04:46

I chose to the hide the REPL window itself. I get what I need from the "Calva Says" window.

pez10:04:39

The results are also available for copying from the evaluations hover (`cmd+k cmd+i` on Mac).

pez10:04:26

We'll figure out some better ways to deal with large results. Eventually that REPL window will just be a faded memory. ๐Ÿ˜ƒ

pez10:04:20

Dear Calva friends. Today I'm thinking about keyboard shortcuts. Not going to do anything about it yet, but I'm curious about a thing right now. On my Mac a shortcut like ctrl+, (ctrl+comma) is quite available, and easy to press. As is ctrl+. (ctrl+dot). Therefore they are candidates for taking over as the Calva Key. How would that work on your keyboards and systems out there?

hindol.adhya10:04:40

Ctrl+, takes me to the VSCode settings, on Windows.

hindol.adhya10:04:00

I think it makes sense to have separate key bindings for each OS.

pez10:04:52

It makes docs awkward to write.

hindol.adhya13:04:51

If you decide to go the per OS route, I can help validate the Windows and Windows/WSL1/2 key bindings.

pez14:04:43

I hope you can consider that even if we don't go that route. ๐Ÿ˜ƒ

hindol.adhya14:04:17

Yes. ๐Ÿ˜

pez14:04:21

I have generally tried to choose windows-friendly shortcuts, but I do not use Windows myself, so I do not know how well it works. On Mac they work, at least, afaict.

sogaiu11:04:12

for reference, i had feedback from someone who decided against continuing to use because the paredit bindings clashed with standard windows usage. i agree with hindol that per-os key bindings make sense.

orestis13:04:29

Does vs code have the concept of the โ€œleaderโ€ key you can customize per user, as with Vim?

orestis13:04:03

Iโ€™d like to be able to customize the โ€œCalva keyโ€ or โ€œleader keyโ€ but then the second key press could be standard.

orestis13:04:23

But to be honest, Iโ€™d apply my Cider shortcuts for most day to day things.

pez13:04:44

No leader key in vscode, unfortunately.

pez13:04:31

About Paredit. If you set its keymap to none, it doesn't conflict with anything.

hindol.adhya13:04:04

Emacs also lets you quickly remap the meta keys.

pitalig15:04:31

Hi! Any suggestions on how I can do some repl customization like https://insideclojure.org/2020/02/11/custom-repl/ in calva's jack-in repl? Should I create a nREPL middleware?

pez16:04:39

I think it might work to use last suggestion there. In the presence of a launch alias, Calva will not use it's own main args, so you will need to provide those with the alias.

pitalig16:04:06

Not sure if I got it correctly, but I tried this:

:repl
{:main-opts ["-e"
             "(require,'[clojure.main,:as,m])(m/repl,:init,#(apply,require,m/repl-requires),:eval,(fn,[form],(do,(require,'[clojure.pprint,:refer,[pp]])(println,100)(eval,form))))"
             "-m"
             "cmdline" "--middleware" "[cider.nrepl/cider-middleware]"]}
But it first starts a repl in the terminal window, where I have the expected behavior, but the jack-in doesn't happen. Then after I exit this repl (`ctrl + d`), it starts the nrepl server and do the jack-in.

pez17:04:54

Maybe you need to start the nrepl server in the eval there?

pez17:04:54

If you figure this out, I think we can find a way to support this more directly in Calva

pez16:04:49

This is what Calva uses when no alias is selected at jack-in: -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware].

jwhitlark16:04:45

One thing I run into when developing with containers, my tools decide to restart the container, and so I lose my repl connection of course. But the container comes right back up with the repl on the same port. Any ideas on how to "auto-reconnect" a repl, say within 10 seconds?

pez16:04:27

I think there is no support for that today. As I happen to know you come from Emacs. Can you do that there? How, if so?

jwhitlark16:04:44

I hadn't run into that particular issue before I switched. Memory is fuzzy, but I'd probably define a hook on repl disconnect (when not intentionally closed), and, say, retry 3 times with backoff.

jwhitlark16:04:20

I've read through the source a couple of times, but I'm still not familiar enough to see exactly how it should work.

jwhitlark16:04:28

Perhaps a setting "retry-on-connection-lost" and then read the config from the repl that just went down, and try it again?

jwhitlark16:04:15

I'm not sure if jack-in would also work for connecting to an already running repl, which is what I end up having to do, as I use https://skaffold.dev/ to build, test, and inject the yaml into kubernetes. It also sets up port forwarding for the repl, so all I have to do is connect.

jwhitlark16:04:16

I had to put a fake .nrepl-port file so that I didn't have to type the port number every time. I found the setting for specifying the port file, but there isn't one (as far as I can see) that allows you to set a default port.

jwhitlark16:04:40

Should I open a feature request?

pez17:04:29

Yes, please do. I think there is some reconnection attempts there. But I could be remembering that wrong.

jwhitlark17:04:38

Done: https://github.com/BetterThanTomorrow/calva/issues/609 Let me know if there's anything I can clarify or any help I can give. Thanks!

pez17:04:27

A PR would be nice. ๐Ÿ˜Ž

jwhitlark17:04:30

Let me see what I can do.