Reputation: 9964
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?
Upvotes: 16
Views: 3293
Reputation: 9508
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
Upvotes: 23
Reputation: 11
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
Upvotes: 1
Reputation: 106351
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.
Upvotes: 2
Reputation: 91877
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.
Upvotes: 8
Reputation: 44706
You can enhance the REPL to do this by using JLine, see here.
Upvotes: 6