Is there a colored REPL for Clojure?

后端 未结 11 661
孤城傲影
孤城傲影 2020-12-23 14:09

I\'d like to get a colored REPL for clojure code, similar to what you can do with IRB for Ruby.

Are there any libraries or settings for user.clj that provide automati

相关标签:
11条回答
  • Rather late to the party, here, but you can get this from using the Leiningen plugin Ultra (which also has support for colorized stacktraces and pretty-printed test output), or by adding Whidbey to your list of Leiningen plugins instead.

    Sample Ultra REPL:enter image description here

    0 讨论(0)
  • 2020-12-23 14:47

    Try out Light Table Playground by Chris Granger. It is the first part of more ambitous multi language IDE.

    It has a color Clojure REPL that does real time evaluations and display for entire blocks of code.

    http://www.chris-granger.com/lighttable/

    You can see a higher level view of the project here:

    http://www.kickstarter.com/projects/ibdknox/light-table

    0 讨论(0)
  • 2020-12-23 14:48

    Some coloring have REPL in VimClojure.

    0 讨论(0)
  • 2020-12-23 14:51
    • Install Emacs 24
    • Install Emacs Starter Kit v2
    • M-x package-install -> starter-kit-lisp
    • Add to init.el: (add-hook 'slime-repl-mode-hook 'clojure-mode-font-lock-setup)
    • Install Swank for Clojure
    • Open your Clojure project and M-x clojure-jack-in

    Emacs REPL

    0 讨论(0)
  • 2020-12-23 14:54

    If you just want to color the prompt and you are using Leiningen (which you should), you can use :repl-options and ANSI escape sequences:

    :repl-options {:prompt (fn [ns]
                             (str "\033[1;32m"
                                  ns "=>"
                                  "\033[0m "))}
    

    References:

    • GitHub – technomancy/leiningen – sample.project.clj
    • roguejs.com – “Console colors in node.js”, posted 2011
    0 讨论(0)
提交回复
热议问题