Light Table for Beginners

Posted on March 05, 2014 in lighttable, sublimetext

I've been using Sublime Text for awhile now and have come to love depend on a lot of the features it offers. When I first heard about Light Table, I was eager to try it out, especially because it boasted a feature called "Vim mode" which basically converted the whole IDE into a Vim instance. Sold.

Here's a breakdown of quick tips I've learned so far using Light Table and why I may never look back at Sublime Text again.

Changing Themes & Settings

It's not obvious at first but I promise you don't need to be a Clojure expert to understand how to change settings in Light Table.

First, open your Command panel (Ctrl+Space) and type "User" - You'll start to see your available options being populated, just like Sublime Text. Navigate to the one titled Settings: User Behaviors

You'll come across a file that looks like this

;; User behaviors
;; -----------------------------
;; Behaviors are stored as a set of diffs that are merged together
;; to create the final set of functionality that makes up Light Table. You can
;; modify these diffs to either add or subtract functionality.
;; Behaviors are added to tags, objects with those tags then automatically gain
;; whatever logic the behavior imparts. To see a list of user-level behaviors,
;; start typing a word related to the functionality you want in between the square
;; brackets (e.g. "theme").

{:+ {
     ;; The app tag is kind of like global scope. You assign behaviors that affect
     ;; all of Light Table here
     :app [( "dark")]

     ;; The editor tag is applied to all editors
     :editor [:lt.objs.editor/no-wrap :lt.objs.editor/line-numbers 
              ( "dark")]

     ;; Here we can add behaviors to just clojure editors
     :editor.clojure [(:lt.plugins.clojure/print-length 1000)]}

 ;; You can use the subtract key to remove behavior that may get added by
 ;; another diff
 :- {:app []}}
If you don't understand Clojure, fear not! Let's change our color scheme to my preferred choice, paraiso-dark (just had Lasek so it's easy on the eyes.)

Change the line ( "dark")] to ( "paraiso-dark")] and save. Awesome! Everything gets updated on the fly. If you backspace the entire theme name and begin to type, it'll even suggest appropriate themes! This is an awesome feature of this entire settings file, almost everything you can configure is preset in a menu so you don't need to know Clojure to make it happen.

Associating File Types

Since I've been working with Magento and Phalcon a lot, I've come to notice that .phtml and .volt files aren't out-of-the-box recognizable. Let's change that.

Find this line :editor [:lt.objs.editor/no-wrap :lt.objs.editor/line-numbers and hit Enter. Now type "file" (notice that nice menu again?) Hit Enter on the option that says Files: Associate file types. Now it's just a matter of filling in the blanks. See below for the .phtml and .volt examples.


(:lt.objs.files/file-types [{:exts [:phtml],
                             :mime "php",
                             :name "Phtml",
                             :tags [:editor.phtml]}])


(:lt.objs.files/file-types [{:exts [:volt],
                             :mime "php",
                             :name "Volt",
                             :tags [:editor.volt]}])


Out of the box, tabs are disabled. Changing that is simple enough

;; Use tabs? | Tab size in spaces | Spaces per indent
(:lt.objs.editor/tab-settings true 2)

More Configurations

So far I've been toying with Light Table for 20 minutes and have already found tons of useful options to play with in this User file. I'll keep this blog updated with new findings and easy tips to help get you rolling with Light Table as well.


Thomas Lackemann :)


Tom is the founder of Astral TableTop. He's a homebrewer, hiker, and has an about page. Follow @tlackemann on Twitter for more discussions like this.