Getting started with Light Table

posted on 2014-07-06

Light Table is an editor that was created after a kickstarted campaing. In the following sections, I will share what I learned after the first week of trying this editor out.

Getting the editor

The editor has become open source and you can simply download and install it using the information on http://www.lighttable.com/.

First use

Although te editor has a menu, most of the interesting things can be found by pressing Ctrl+Space. This will open a command pane on the right which allows you to search for different commands: opening the plugin manager, create a new workspace, open an editor with the user settings.

This is one of the more important parts of the editor if you ask me. The editor will thrive from being extendable, and having an easily searchable menu is key to allowing every plugin to have their own options.

Opening files, adding folders to your workspace, etc. Most of this can be found by just diving in and trying for context menu's and searching in this command pane.

On to the more interesting stuff.

Enabling auto-save

If you are like, most of your typing work will end up in a git repo or backed-up folder. This means that auto-saving is key to having a good editing experience.

To enable auto saving, open the command pane with "Ctr-Space", then search for Settings: user behaviors. Select it to open a file with a configuration object describing all the user behaviors of the editor.

In this file, you can add and remove behaviors. Here is my user.behaviors file:

{:+ {
     :app [(:lt.objs.style/set-skin "dark")]

     :editor [:lt.objs.editor/no-wrap
              :lt.objs.opener/save-all-on-focus-lost
              :lt.plugins.trail-whitespace/show-trailing-whitespace
              (:lt.objs.style/set-theme "default")
              (:lt.objs.editor/tab-settings false 4 4) ;; use tabs?, tab size in spaces, indent unit
              ]

     :editor.clojure [(:lt.plugins.clojure/print-length 1000)]}

 :- {:app []}}

The thing I added to enable auto save on focus lost in Light Table is the line:

:lt.objs.opener/save-all-on-focus-lost

Also note that this editor has auto-completion, so you might want to try different things starting with :lt., just to see what is there.

Show trailing whitespaces

Most people don't care for trailing whitespaces, but if you do, then use the plugin manager to install the Trailing Whitespace plugin and add the line:

:lt.plugins.trail-whitespace/show-trailing-whitespace

to your user.behaviors file.

Tab size, use spaces instead of tabs

Next up, use spaces instead of tabs if you want. I decided on a tab space of 4 and using spaces instead of tabs:

(:lt.objs.editor/tab-settings false 4 4) ;; use tabs?, tab size in spaces, indent unit

Shortcut keys you can add

Using the command pane, crtl-space, you can also open user.keymap. This file contains a collection of shortcut keys. I have decided I needed the following configuration in there:

{:+ {:app {}

     :editor {"alt-w" [:editor.watch.watch-selection]
              "alt-shift-w" [:editor.watch.unwatch]
              "ctrl-shift-l" [:smart-indent-selection]
              "ctrl-/" [:toggle-comment-selection :editor.line-down]
              "ctrl-y" [:editor.select-line :editor.cut]}}}

For each of the keys strokes mentioned in the strings, the list of commands following it are executed.

To yank a line use "ctrl-y". To comment out a piece of code, use "ctrl-/". To indent a selection, use "ctrl-shift-l".

As you can see, this file still needs to grow and I think that I'll probably download some kind of default in the future.

More to look at

This should get you going with the basics, but there is much more to learn and try. Don't forget to try out the various plugins and get some practice with the workspace and opening files and folders.

But keep in mind, because the editor is still a bit flaky when it comes to ease of use, your will find yourself looking up simple things in bug reports and blog posts.

Happy typing!