问题
Name the ways you know to start the Clojure REPL. What is your favourite ? Does it highlight things for you ?
I know of : 1. NetBeans IDE with the Enclojure plugin, and 2. the Leiningen shell script : lein repl
No favorite for me so far, and I'd certainly like some colors.
What else ?
回答1:
Syntax-highlighted Clojure REPL is entirely possible in Emacs -- I wrote the necessary code in response to a very old question here on SO: Is there a colored REPL for Clojure? I have since tweaked it to handle the prompt and printouts from the Clojure process properly; the updated version is available in this Gist. Note that it's meant to augment the SLIME REPL and that the most recent version relies on a reasonably fresh clojure-mode. I was going to package this properly so that slimey Clojurians can just drop it into their Emacs configs... might just do it sometime soon.
As another option, I seem to have an extremely vague recollection of VimClojure's REPL highlighting user input a long time ago... I definitely could be wrong about this, though.
Oh, and since you're curious about other possible ways to start Clojure REPLs -- all the IDE plugins provide their own REPLs; you could use the regular inferior-lisp-mode in Emacs; java -jar clojure.jar
starts a REPL with the current working directory on the classpath; if you embed swank-clojure in your app, you can start REPL servers from within it; VimClojure provides a nice REPLing experience inside Vim (and I believe it provides an equivalent of M-x slime-connect, though, once again, I haven't used it in a pretty long time); you can use Leiningen or clojure-maven-plugin to start stand-alone REPLs or swank instances (I'd expect other Clojure-aware build tools to be capable of this too); cljr can start console REPLs, REPLs packaged in a Swing window and swank instances; there might be more.
回答2:
You can start one with Redcar Editor using the Enclojure REPL. This blog post has a screenshot of it in action. It does support colored syntax highlighting. Redcar support for clojure in general isn't great right now, but I am working on improving the experience. If you try it out, let me know what you think.
回答3:
Cljr is a Clojure REPL and package manager by David Liebke.
It meets the need for a repl for "just trying stuff out". A plain command line repl, a swing repl and a swank server (for use with Emacs SLIME mode) can be started with easily managed clojure and java dependencies available.
回答4:
If I'm in Emacs or have an Emacs sitting open somewhere, I typically just use SLIME connected to a swank server. I get a highlighted REPL that way and all the power of Emacs right there in my REPL.
When I don't have Emacs handy, I use cake to start an REPL in a terminal. I don't get highlighting like this, but you can get excellent multiline support and even completion.
回答5:
#!/bin/bash
# Start Clojure REPL (assumes clojure.jar and clojure-contrib.jar are in /opt/clojure
# Don't remember where I got this originally
# GUI mode
if [ "$TERM" == "dumb" ]; then
gnome-terminal -t Clojure -x $0 $* &
exit
fi
breakchars="(){}[],^%$#@\"\";:''|\\"
rlwrap --remember -c -b "$breakchars" \
java -Djava.ext.dirs=/opt/clojure clojure.main -i $HOME/.clojurerc --repl
回答6:
You can use this little hack to "inject" a remote Clojure repl into your running application (with remote debugging enabled, but otherwise unmodified): https://github.com/wirde/swank-inject
来源:https://stackoverflow.com/questions/3583046/ways-to-start-clojure-repl