Colorized Leiningen REPL Plugin
Today has been a day for colorization, and while I was at it, I decided to see what I could find that did this for Leiningen's REPL. What I found was simply too cool to believe.
There'a a GitHub project called Ultra - and it's a plugin for Leiningen that colorized the return values from the REPL so that they are a lot easier to read. Keywords, strings, numbers, maps... all are a lot easier to read with this plugin. And installing it was easy.
First, I needed to update to the latest Leiningen - and since I'm using the one in Homebrew, that's just:
$ brew upgrade leiningen
and let it finish. This brought me to version 2.5.1.
Now just add to my ~/.lein/profiles.clj the user section:
{ :user {:plugins [[venantius/ultra "0.3.3"]] :ultra {:color-scheme :solarized_dark}} }
and then restart the REPL:
$ lein repl
All the dependencies will be downloaded, and then you'll see something really cool like:
And this is going to make it all so much easier to work in the REPL. I remember going from a black-and-white editor to a colorized editor and it was as if the world of coding had changed. No longer did I have to stare intently at the code to discern it's meaning, the color told me what was important, and what wasn't. It was just amazing to my productivity.
I'm hoping I get even a fraction of that boost using these new colorization tools for log4j files and the REPL. How exciting!
UPDATE: I played around with the colors to make it look a little more like the clojure syntax file for Vim:
where the new ~/.lein/profiles.clj file looks like:
{ :user {:plugins [[venantius/ultra "0.3.3"]] :ultra {:color-scheme {:delimiter [:bold :yellow] :tag [:bold :yellow] :nil [:cyan] :boolean [:bold :cyan] :number [:bold :blue] :string [:bold :red] :character [:cyan] :keyword [:yellow] :symbol nil :function-symbol [:bold :blue] :class-delimiter [:blue] :class-name nil :exception nil}}} }
I'm not completely happy with these colors, but they are about as good as I'm likely to get with the ANSI color selections at my disposal. And hey... let's not forget... it could be a lot worse! 🙂
[11/20/2018] UPDATE: I've gone back and updated to the latest version of the plugin, and updated the colors for something that's much more interesting to me. The plugin is now specified as:
{ :user {:plugins [[venantius/ultra "0.5.2"]] :ultra {:color-scheme {:delimiter [:bold :yellow] :tag [:bold :yellow] :nil [:cyan] :boolean [:bold :cyan] :number [:bold :green] :string [:bold :red] :character [:cyan] :keyword [:yellow] :symbol [:bold :magenta] :function-symbol [:bold :blue] :class-delimiter [:blue] :class-name [:green] :exception [:bold :red]}}} }
which includes the new colors for the symbol, number, class name, and exception. I was never a fan of the bold blue for numbers, because on a dark background, it was way too hard to read. Now it's just great. Much improved.