cursive

2025-09-02T18:42:12.230239Z

I was trying to help @ricardominamendes get a good repl hygiene as they learn Clojure with Cursive. And what I remember is you have to manually setup a keybinding for eval, the doc seems to say it's called "Run form before cursor", but they couldn't find it. My suggestion was to set it to Ctrl+enter or something super easy since you'll be running that command like every second as you code. Does someone know how to configure it?

imre 2025-09-02T18:53:38.868239Z

Send form before caret

imre 2025-09-02T18:53:53.069749Z

Send top level form

imre 2025-09-02T18:54:07.420679Z

I think these are the commands

salam 2025-09-02T18:56:50.184429Z

rikkarth 2025-09-02T19:02:36.110899Z

Oh nice, thank you so much guys. I will try this and come back to you. Super thanks to you @didibus šŸ™

2025-09-02T19:12:39.156379Z

No problem. I love Cursive, it's really good, but I've found people often go without the REPL for way too long with it, and I've seen many people drop Clojure because they never used the repl and got used to repl-driven development. I wish it like had a popup to suggest you setup keybindings or even defaulted to some.

2025-09-02T19:13:54.713969Z

Another reason is it has really good static analysis, so you feel you don't need the repl as much. But ya, just make sure you always have a REPL connected, it's the way to go. Every line of code I add/edit I eval it in the REPL.

2025-09-02T19:15:59.487559Z

@abdusalam Does it automatically evaluate in the context of the namespace where you sent the form from? Or do you still have to manually switch namespace?

rikkarth 2025-09-02T19:17:59.105419Z

I really like the REPL in Clojure because of the FP and LISP nature of Clojure. It's like you can test small parts of your program in real time, and you can even then bring some of the use cases in the REPL as unit tests. It's just really gives meaning to the test driven development you read in books and then never really understand or apply - it kinda makes a lot more sense in Clojure.

šŸ’Æ 1
rikkarth 2025-09-02T19:18:42.660739Z

Also the way IntelliJ integrates cursive and the ease of use really makes the tool first class citizen.

rikkarth 2025-09-02T19:19:29.330299Z

I've been programming in Python at my work for example, but because no one in my team even knows what FP is, the REPL is useless.

salam 2025-09-02T19:23:28.275179Z

> @abdusalam Does it automatically evaluate in the context of the namespace where you sent the form from? Or do you still have to manually switch namespace? by default, Cursive evaluates forms in the namespace they are in. there is a setting (ā€œEvaluate forms in REPL namespaceā€) which, when enabled, causes Cursive to evaluate forms in the REPL’s namespace.

šŸ‘ 1
2025-09-02T19:26:01.134939Z

Ok nice. The default behavior is what I wanted. I think a while back it didn't used to do that, I remember having to manually switch the namespace myself.

2025-09-02T19:30:45.921009Z

@ricardominamendes This is a good thing to know as well, as it's not immediately obvious. But when you eval something, in theory there is the question of in what context to eval it, which really means under which namespace, which is the value of *ns*. In both Cider and it seems Cursive. Your REPL window could be showing that it is in the user namespace. But if you run the eval command in a file and the place in the file where you ran the eval is under the namespace foo, it'll actually evaluate the form under foo and not under user. Generally that's what you want, because you expect that all the functions and variables from foo are available when evaluating something inside foo. Some tooling might not do that, so it's something to be aware.

rikkarth 2025-09-02T20:01:18.559919Z

I just tested it and it works perfectly, I love it! I configured just like @abdusalam has it in screenshot.

šŸ™Œ 1
rikkarth 2025-09-02T20:02:12.317869Z

This seems like a super common way of using the REPL between Clojurers but somehow this is not default in Cursive šŸ˜›

rikkarth 2025-09-02T20:05:03.708579Z

> there is a setting (ā€œEvaluate forms in REPL namespaceā€) which, when enabled, causes Cursive to evaluate forms in the REPL’s namespace. I just tried this setting and I actually like it because I don't have to manually "switch namespace"

rikkarth 2025-09-02T20:05:16.685459Z

So basically it will just assume the file I have open (apparently)

rikkarth 2025-09-02T20:05:38.874219Z

I can just focus on sending form to repl and executing it

rikkarth 2025-09-02T20:05:46.642819Z

is this bad?

salam 2025-09-02T20:07:28.632219Z

no, there’s nothing wrong with either approach. it’s good to have a choice so that you can pick whatever fits your needs/workflows.

rikkarth 2025-09-02T20:09:14.645579Z

i feel like a super productive newbie right now xD thank you guys

🤘 1
2025-09-02T20:19:48.986559Z

> So basically it will just assume the file I have open (apparently) I don't know which setting do what, but the one I recommend is that it evaluates in the namespace of the file where the form you are evaluating in is.

2025-09-02T20:22:19.957799Z

Like say you have:

Tab1
foo.clj
(ns foo)
(def name "Foo")

name| <-- Your cursor is here and you run Ctrl+Enter to eval name, it should return "Foo"
Tab2
bar.clj
(ns bar)
(def name "Bar")

name| <-- Your cursor is here and you run Ctrl+Enter to eval name, it should return "Bar"
If you keep switching between evaluating name in Tab1 or Tab2, it automatically adapts the context and so you see Foo or Bar based on which file you are in when you evaluate.

2025-09-02T20:22:36.363809Z

Whatever setting does this, that's the setting I recommend.

2025-09-02T20:22:59.380649Z

But it's a personal preference obviously. Just got to know how you have it configured so you don't get confused at what is happening.

rikkarth 2025-09-02T20:25:26.840609Z

This is what I have setup right now exactly how you described it @didibus

1
rikkarth 2025-09-02T20:25:27.848439Z

šŸ™‚

2025-09-02T20:29:45.974619Z

Ya, in Cider (the Clojure Emacs plugin), that behavior along with having a shortcut for eval is the default. I feel it gives the best repl experience personally.

salam 2025-09-02T19:43:48.296749Z

Colin, Cursive appears to have some compatibility issues with https://blog.jetbrains.com/platform/2025/06/testing-a-fresh-look-for-jetbrains-ides/ā€œhttps://blog.jetbrains.com/platform/2025/06/testing-a-fresh-look-for-jetbrains-ides/https://blog.jetbrains.com/platform/2025/06/testing-a-fresh-look-for-jetbrains-ides/https://blog.jetbrains.com/platform/2025/06/testing-a-fresh-look-for-jetbrains-ides/ā€https://blog.jetbrains.com/platform/2025/06/testing-a-fresh-look-for-jetbrains-ides/ that’s coming down the pike and, i think, are worth looking into before the themes hit a release. in this particular instance shown in the screenshot, the separator between the REPL output pane and the input panel is invisible:

cfleming 2025-09-25T05:58:37.568859Z

Just to let you know, I've switched to this theme in 2025.3, and I can see the problems, I've filed some issues: https://youtrack.jetbrains.com/issue/IJPL-209552/With-Islands-theme-horizontal-JBSplitter-is-invisible https://youtrack.jetbrains.com/issue/IJPL-209555/With-Islands-theme-caret-of-editor-in-toolwindow-is-invisible

salam 2025-09-25T06:28:25.131279Z

thanks for the update! hopefully, they will fix these along with all other known issues throughout the EAP period.

cfleming 2025-09-02T21:52:52.004779Z

Thanks Salam, I'll check that out.

šŸ‘ 1
cfleming 2025-09-09T00:46:40.881329Z

I may be daft, but how do I install these? I don't see them at Settings | Appearance &amp; Behavior | Appearance or in the Marketplace.

cfleming 2025-09-09T00:47:33.322719Z

Ah, never mind, I can see the instructions in the comments, you have to enable a registry key in 2025.2

salam 2025-09-09T00:47:40.658639Z

yup

salam 2025-09-09T00:48:13.356799Z

i was going to type all that out for you. yeah, they are invisible due to a bug.