Skip to content

Instantly share code, notes, and snippets.

@dln
Forked from Chouser/repl-init.clj
Created May 20, 2010 14:30
Show Gist options
  • Save dln/407622 to your computer and use it in GitHub Desktop.
Save dln/407622 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 -cp 'src/:lib/*' clojure.main \
; -i ~/.clojure/repl-init.clj
(use 'clojure.contrib.repl-utils)
(use '[clojure.contrib.pprint :only []])
(add-break-thread!)
(defn my-repl []
(clojure.main/repl
:prompt #(printf
"\033[1;38;5;51m%s \033[1;38;5;45m>>>\033[0m "
(ns-name *ns*))
:print (try
(fn [x]
(print "\033[38;5;77m")
((resolve 'clojure.contrib.pprint/pprint) x)
(print "\033[m\n")
(flush))
(catch Exception e
(prn e)))
:caught (fn [x]
(print "\033[38;5;220m")
(prn x)
(print "\033[m\n")
(flush))))
(set! *print-length* 103)
(set! *print-level* 15)
(my-repl)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment