Skip to content

Instantly share code, notes, and snippets.

@Chouser
Created May 20, 2010 12:51
Show Gist options
  • Save Chouser/407528 to your computer and use it in GitHub Desktop.
Save Chouser/407528 to your computer and use it in GitHub Desktop.
; This is ~/.clojure/repl-init.clj
;
; I start a clojure repl something like:
; rlwrap --remember --complete-filenames \
; --history-filename ~/.clojure/history \
; --break-chars "\"\\'(){}[],^%$#@;:|" \
; java -server -Xbootclasspath/a:clojure.jar \
; -cp clojure.jar:clojure clojure.main \
; -i ~/.clojure/repl-init.clj -e "(my-repl)"
(set! *print-length* 103)
(set! *print-level* 15)
(use 'clojure.contrib.repl-utils)
(use '[clojure.contrib.pprint :only []])
(add-break-thread!)
(defn my-repl []
(clojure.main/repl
:prompt #(printf
"\033[32m-----\033[m\n%s=> "
(ns-name *ns*))
:print (try
(fn [x]
(print "\033[34m")
((resolve 'clojure.contrib.pprint/pprint) x)
(print "\033[m")
(flush))
(catch Exception e
(prn e)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment