Intellij / Cursive set up

Hi everyone,

How are you?

I am on W10 and I successfully installed lein and it is running on cmd.

I was wondering the workflow using cursive and how to set up to work properly and evaluate the code on the fly.



I’d create a new project with lein new and use Cursive’s import to create a project from the lein sources. Then you can create a REPL configuration for Leiningen, start a REPL and send expressions to it.

Where specifically do you get stuck?

Also, the video you posted looks dated. I followed the instructions on the website:

Thanks Teodorlu,

I can run functions besides the main on a project.

What would be the workflow using Intellij/Cursive?

After you write a function, just call on the repl, like so: (function)

That’s it?
If this is right, looks like intellij is not saving other function on my project and REPL don’t know them.

ok, uninstalled everything and got it working.

The repl inside the intellij, the problem was the name space I needed to add (ns-project.core), initial tests are working.

I was wondering how to set up the perfect development experience on intellij / Cursive.


I avoid manually typing in the REPL buffer, and rather send expressions from the source code to be evaluated. @vvvvalvalval has written some really good content on how to use the REPL.

  1. Introduction: The REPL based development demo video from his What makes a good REPL article
  2. Follow up: The official Programming at the REPL guide.


I appreciated your help!!
Figure 2. An editor-integrated Clojure REPL

On the second figure, on Intellij, it shows writing code on intellij and running on repl automatically, giving the answers, how can I do that?

You need to add a Local repl as a Run Configuration, explained here:

Once you have a REPL running for your project, you need to use the shortcuts:

  • Alt-Shift-P - will evaluate the top-level form your cursor is on in the REPL
  • Alt-Shift-L - will load the file you are in, into the REPL
  • Alt-Shift-M - will load all modified files into your REPL
  • Alt-Shift-R - will change the REPL namespace to the one of the file you are in

And I recommend you go in File -> Settings -> Keymap and search for Send form before caret to REPL and add the keyboard shortcut Ctrl+Enter for it. You can leave other assignments for it, I don’t believe they conflict.

That way, you can just put your cursor (caret) at the end of any s-expr and evaluate the s-expr into the REPL by pressing: Ctrl+Enter.

1 Like

Thanks didibus, so there is no way to evalute the code on the fly like nighcode?

Not to my knowledge. Maybe you can setup a save action to perform “Synchronize with repl”. I havn’t tried it though.

Cider has such a mode though, if you are willing to run Emacs. That said, in my experience, it can get a bit out of hand. And I prefer being in charge of when to send things to the REPL.

The gif is definitly just someone using the keyboard shortcut in a timely manner, which makes it appear as if it is automatic.

Here’s an example of what I meant.

It is on the fly, no?

How did he defined the namespace?

Cool, I learnt how to do that on Intellij, kind of……with alt+shift+P.

When LightTable first appeared, one of the things that got me excited about it was the auto-eval mode. When I actually used it, I found it was terribly distracting for real-world code, because it would evaluate code before I’d finished a form so I’d get errors, or if I typed something incorrectly, it might run side-effect-y code and “launch missiles” (the usual joke in Clojure conference talks about evaluating code with side-effects). So I stopped using it and just got used to using hotkeys to evaluate each completed form as I typed.

I switched from LightTable to Emacs for a while and then to Atom/ProtoREPL. It also had an auto-eval mode so I tried it again but very quickly turned it off, for exactly the same reasons that made me abandon it in LightTable.

Now I use Atom/Chlorine and, like every editor I’ve used with Clojure since 2010, I use hotkeys to evaluate a form or a top-level form, whenever I want. It’s a very productive workflow, with no distracting “partial evaluations” done by the system unexpectedly.

(This is also why I dislike auto-runners for tests – I tend to evaluate code forms as I write them and I save files periodically regardless of the state they are in, so having tests run-on-save by a watcher is pointless at best and very distracting! Instead, I run tests via hotkeys whenever I want to sanity check something specific since I’m continually running code in the REPL via hotkeys to make sure it does what I expect)

1 Like

Thanks Sean, but I believe for a beginner this auto eval could be helpfull.

I will try the Atom/Protorepl with auto eval and let you know.


This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.