I'm doing my first steps with Clojure, but for some reason the up/down keys don't allow me to step through the command history in the REPL like in REPLs of other languages. Does the Clojure REPL use different keys to access the command history, or is this feature just not (yet) implemented?
If you are, by any chance, using a Unix-like environment you can use rlwrap
to to achieve nice things like command line history and Ctrl-R for searching through it.
Just prepend your command which you use to start repl, e.g:
rlwrap java -cp clojure.jar clojure.main
Or use Leiningen or Cake. Either of these are useful in general, and you'll be happy to learn to use them, but specifically they use readline or jline automatically where available.
You can enhance the REPL to do this by using JLine, see here.
Depends which REPL you use. Most good REPLs have this functionality and more.
If you're coming from Java as an Eclipse user, for example, you may want to use the embedded nREPL provided by the Counterclockwise plugin. I found this easier to use than configuring a separate dedicated Clojure environment.
C-, M-x slime-repl-forward-input C-, M-x slime-repl-backward-input Go to the next/previous history item.
http://common-lisp.net/project/slime/doc/html/Input-Navigation.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With