/ Published in: Clojure
Using rlwrap in order to wrap Clojure REPL (getting vi bindings & auto completion).
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/bin/bash BREAK_CHARS="(){}[],^%$#@\"\";:''|\\" CLOJURE_DIR=/home/cljuser/install/clojure CLOJURE_JAR=$CLOJURE_DIR/clojure.jar if [ $# -eq 0 ]; then rlwrap --remember -c -b $BREAK_CHARS -f $HOME/.clj_completions \ java -cp $CLOJURE_JAR clojure.lang.Repl else java -cp $CLOJURE_JAR clojure.lang.Script $1 -- $@ fi ; generating the completion file (def completions (reduce concat (map (fn [p] (keys (ns-publics (find-ns p)))) '(clojure.core clojure.set clojure.xml clojure.zip)))) (with-open [f (java.io.BufferedWriter. (java.io.FileWriter. (str (System/getenv "HOME") "/.clj_completions")))] (.write f (apply str (interleave completions (repeat "\n")))))
URL: http://en.wikibooks.org/wiki/Clojure_Programming/Getting_Started#Enhancing_Clojure_REPL_with_rlwrap