Clojure REPL readline like support

放肆的年华 提交于 2019-12-18 12:47:19

问题


Several REPLs (like ruby's irb) have some very useful features, such as using the arrow keys to "rewind" and "forward" the command history; but when I try to do the same with Clojure, it only prints garbage (I suspect it prints the keycode). How can I get this feature in the Clojure REPL?


回答1:


You need to use JLine or rlwrap. Refer to http://en.wikibooks.org/wiki/Clojure_Programming/Getting_Started#Enhancing_the_Environment for assistance




回答2:


Download jline from here and copy the jar to the directory from where the clojure.jar is loaded. The clj script should find and enable it.

On the other hand if you use leiningen to organize your projects, which I heartily recommned, then you do not have to do anything other than run lein repl and the REPL starts with the expected history behavior and all dependencies of your project on the classpath.




回答3:


This depends on how you start your REPL. For example liebke's cljr has a nice REPL with readline support:

http://github.com/liebke/cljr



来源:https://stackoverflow.com/questions/3763926/clojure-repl-readline-like-support

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!