Fork me on GitHub
#calva
<
2021-05-11
>
bringe02:05:09

@pez @plexus I had a friend experience a similar thing recently (on Windows) in that some audio program he had installed had edited his hosts file.

Janne Sauvala06:05:30

Hello 👋:skin-tone-2: when using Calva + the vim extension (vscodevim) and trying to eval some forms, the eval doesn’t include the last ) that is under the caret. This happens when you have normal mode activated. In the insert mode you can move the caret at the end of the last ) so the eval works. I was wondering if you have come up with some Calva (or vscodevim) specific setting which could make the eval to include the last ) when using the normal mode? 🙂

practicalli_john07:05:51

Sounds like the last expression is being evaluated rather than the top level expression. VSpaceCode will do both types of evaluation commands, so maybe there is a different keybinding / command to use with the vscodevim extension. Or just move to the line after the expression and evaluate

pez07:05:25

Actually Calva doesn’t really have a concept of last sexpression. It will try to find the “current” form.

practicalli_john07:05:28

In Calva, evaluate the current form behaves like evaluate last s-expression when the cursor is after a nested expression but still within a top-level expression

practicalli_john07:05:55

For example, with the cursor on the last closing paren in this expression (- 10 (* 2 3)) , the "evaluate current form" will return 6 using "evaluate top level form" returns 4

practicalli_john07:05:42

So my suggestion to the original question is to use "Calva: Evaluate top level form". Or move to the next line and use "Calva: evaluate current form" which evaluates the top level form it finds behind the cursor.. shouldnt matter how many empty lines there are.

practicalli_john07:05:55

So unless a specific nested form should be evaluated, then use "Evaluate top level form"

pez08:05:28

Calva will evaluate (* 2 3) if the cursor is before it as well (unless there is a previous sexpr on the same line, which will take precedence.

practicalli_john08:05:54

Good to know. I like the simplicity of current and top form evaluation. The Calva approach seems a simpler than the 8 different command available for Cider 🙂

😄 2
Janne Sauvala09:05:16

Great tip to switch to use “Evaluate top level form” instead, thanks :thumbsup::skin-tone-2:

pez09:05:36

File a feature request about it, @UJZ6S8YR2. Maybe there is a way we can detect the normal mode.

pez09:05:10

You can also try configuring a custom command for now. Yesterday I pushed a change that makes it easier to get keyboard shortcuts bound to those. There are quite a few predefined ones,, chords starting with ctrl+alt+space and then things like a-`z` and digits and some more. See https://calva.io/custom-commands/

pez09:05:34

A shortcut something like this might work:

"calva.customREPLCommandSnippets": [
        {
            "name": "Normal mode eval current form",
            "key": "enter",
            "snippet": "$current-form)"
        }
    ]
And would then be bound to the keyboard shortcut ctrl+alt+space enter

pez09:05:46

Also try what is evaluated in normal mode if you have the cursor adjacent before the list.

Janne Sauvala09:05:04

Thanks, Peter. I can try that also 🙂

pez11:05:22

I tried vscodevim myself now. I had misunderstood the behaviour some, so that custom command won’t cut it. I noticed that having the cursor on the opening bracket or before it evaluated the form though.

practicalli_john11:05:35

For comparison, in VSpaceCode I use the , e f for the top level form and , e e for last expression, to match the bindings in Spacemacs and SpaceVim

pez12:05:08

, e e for current expression. 😃

pez12:05:16

foo
 | bar
| denoting the cursor. bar will be evaluated.

pez12:05:49

foo | bar
foo will be evaluated

practicalli_john13:05:42

Really useful to know about the way current expression works, I like it. Thank you.

djptek14:05:30

There is kind of a disclaimer here: https://calva.io/vim/ & I don't think that's all on calva as I have issues with vim bindings with other languages on Visual Studio Code. So, TBH if I'm feeling Vimmy I've been using https://liquidz.github.io/vim-iced/ lately & I actually have the Vim plugin disabled in VS Code 😕

practicalli_john17:05:18

I only had to remap Calva Esc key binding to Shift-Esc and all was fine with Calva and VSpaceCode for key bindings. I should add the submitted VSpaceCode key bindings for Calva on the page you mentioned, thank you for the reminder.

borkdude09:05:46

@pez As a quick workaround for Windows / Oracle 15 issues: people can set JAVA_CMD to override the executable that is being used by tools.deps. It might not be as beginner friendly, but it offers them a way out. You could also hack this yourself: if you detect the executable is this weird Oracle "wrapper?!", then you search for the corresponding "working" java executable and set JAVA_CMD to that (for the Getting Started REPL only I'd say)

pez10:05:49

Makes sense. Maybe something like where java and if it has Oracle in there, tell the user to update jackInEnv with the path to the non-“wrapped” executable….

mschmele13:05:54

Hey y’all - I’m trying to load rebl from calva, and no matter what I do I always get

; Execution error (ClassNotFoundException) at java.net.URLClassLoader/findClass (URLClassLoader.java:382).
; cognitect.rebl
I’m using the leiningen instructions on the site, and am using the latest Oracle JDK. I have rebl downloaded, have run the install script, morning and am using the absolute path to the jar file. Has anybody had problems like this before?

borkdude13:05:44

@mschmele There is an error with passing EDN arguments to latest Oracle JDK's (higher or equal to 15 roughly)

borkdude13:05:04

see the previous message(s)

borkdude13:05:17

you're better off using AdoptOpenJDK or a workaround by setting JAVA_CMD

mschmele13:05:00

Ah gotcha, thanks

mschmele13:05:02

still doesn’t seem to be working for me even after changing my java version to OpenJDK 11

pez14:05:31

I haven’t tried REBL lately, maybe something has changed…

pez14:05:51

Let’s see if we have some REBL users in this channel who can assist.

🙌 1
pez16:05:03

TIL: Installing the VIM extension means all VS Code windows get it enabled w/o reloading the window. But to disable VIM you’ll need to reload all those windows. In my case 12 of them… Gah!

🙀 1
stianalmaas18:05:17

😁 Very much in the style of the old joke about how easy it is to quit vim 😜

Leo Ware23:05:06

dumb question but how to you run the whole file? I don't want to option+enter every function every time

Stuart23:05:50

Load Current File and Dependencies

Stuart23:05:10

Can right click to do it and select from menu (or on my machine its Ctrl+Alt+C Enter)

👍 4