Skip to content

Instantly share code, notes, and snippets.

@Chouser
Created May 20, 2010 12:51
Show Gist options
  • Select an option

  • Save Chouser/407528 to your computer and use it in GitHub Desktop.

Select an option

Save Chouser/407528 to your computer and use it in GitHub Desktop.

Revisions

  1. @invalid-email-address Anonymous created this gist May 20, 2010.
    30 changes: 30 additions & 0 deletions ~/.clojure/repl-init.clj
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    ; 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)))))