Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added color repl

  • Loading branch information...
commit 29261b34cced8efd1389d35ce9bee78e6f671c98 1 parent 0c8abb1
@icylisper icylisper authored
Showing with 26 additions and 7 deletions.
  1. +7 −5 contrib/jark/vim.clj
  2. +19 −2 modules/_ns.clj
View
12 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")
View
21 modules/_ns.clj
@@ -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))))
Please sign in to comment.
Something went wrong with that request. Please try again.