Skip to content

Commit

Permalink
Added color repl
Browse files Browse the repository at this point in the history
  • Loading branch information
icylisper committed Mar 23, 2011
1 parent 0c8abb1 commit 29261b3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
12 changes: 7 additions & 5 deletions contrib/jark/vim.clj
@@ -1,11 +1,13 @@
;; contributed by Ambrose Bonnaire-Sergeant

(ns jark.vim
(:gen-class)
(:use vimclojure.nails))
(:gen-class)
(:use vimclojure.nails))

(defn start
"Start a vimclojure server"
([] (start-server-thread "127.0.0.1" 2044)))
"Start a vimclojure server"
([] (start-server-thread "127.0.0.1" 2044)))

(defn stop []
"todo")
"todo")

21 changes: 19 additions & 2 deletions modules/_ns.clj
Expand Up @@ -50,5 +50,22 @@
(defn repl
"Launch a repl with given ns"
[namespace]
(let [fx (fn [] (in-ns (symbol namespace)))]
(clojure.main/repl :init fx)))
(clojure.main/repl
:init (fn [] (in-ns (symbol namespace)))

: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")
(flush))
(catch Exception e
(prn e)))
:caught (fn [x]
(print "\033[38;5;220m")
(prn x)
(print "\033[m")
(flush))))

0 comments on commit 29261b3

Please sign in to comment.