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?
Send form before caret
Send top level form
I think these are the commands
Oh nice, thank you so much guys. I will try this and come back to you. Super thanks to you @didibus š
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.
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.
@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?
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.
Also the way IntelliJ integrates cursive and the ease of use really makes the tool first class citizen.
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.
> @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.
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.
@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.
I just tested it and it works perfectly, I love it! I configured just like @abdusalam has it in screenshot.
This seems like a super common way of using the REPL between Clojurers but somehow this is not default in Cursive š
> 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"
So basically it will just assume the file I have open (apparently)
I can just focus on sending form to repl and executing it
is this bad?
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.
i feel like a super productive newbie right now xD thank you guys
> 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.
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.Whatever setting does this, that's the setting I recommend.
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.
This is what I have setup right now exactly how you described it @didibus
š
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.
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:
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
thanks for the update! hopefully, they will fix these along with all other known issues throughout the EAP period.
Thanks Salam, I'll check that out.
I may be daft, but how do I install these? I don't see them at Settings | Appearance & Behavior | Appearance or in the Marketplace.
Ah, never mind, I can see the instructions in the comments, you have to enable a registry key in 2025.2
yup
i was going to type all that out for you. yeah, they are invisible due to a bug.