FAQ

kenny-evitt edited this page Feb 1, 2016 · 44 revisions

Overview

Installation

Windows

There are two potential issues pertaining to the path of the directory in which LT is installed on Windows computers:

Because of those issues you should install LT in a top-level directory or another directory whose path does not contain spaces.

The first issue should also be resolved by granting your Windows user, or an appropriate group of which it's a member, Modify permissions (at least) for the sub-directory of Program Files in which you copy the LT files.

Configuration

How do I load custom javascript files on startup?

Add a :lt.objs.plugins/load-js behavior to your user.behaviors to load javascript files. For example:

[:app :lt.objs.plugins/load-js "/Users/me/full/path/to/my.js"]

Argument for behavior might be a string or a vector of strings.

How do I load custom css files at startup?

Put your css in a file and insert the :lt.objs.plugins/load-css into your user.behaviors:

[:app :lt.objs.plugins/load-css "/full/path/to/my.css"]

Argument for behavior must be a string.

How do I define a custom file type?

Add a :lt.objs.files/file-types behavior to your user.behaviors. For example, to define a filetype .foo:

[:files :lt.objs.files/file-types [{:name "foo" :exts [:foo] :mime "text/x-foo" :tags [:editor.foo]}] ]

:exts also works for filenames. For example, a Ruby plugin could have :exts [:Rakefile :Gemfile :config.ru :rb] where the first three are filenames.

How do I turn off LT's autopolling?

To use LightTable offline, add the following behaviors to respective sections in your user.behaviors:

[:app :lt.objs.metrics/disable-metrics]
[:app :-lt.objs.deploy/check-version]

How do I configure Paredit with Vim mode?

Add the following snippet to Settings: User keymap.

[:editor.keys.vim.normal ">" :paredit.grow.right]
[:editor.keys.vim.normal "<" :paredit.shrink.right]
[:editor.keys.vim.normal "cmd-shift-," :paredit.shrink.left]
[:editor.keys.vim.normal "cmd-shift-." :paredit.grow.left]

How do I hide the intro page?

Add the following to Settings: User behaviors.

[:app :-lt.objs.intro/show-intro]

How do I get rid of the menubar at the top?

Add the following to Settings: User behaviors.

[:app :-lt.objs.menu/create-menu]
[:app :-lt.objs.menu/set-menu]
[:window :-lt.objs.menu/set-menu]

How do I run a command automatically when LightTable starts up?

Add the following to Settings: User behaviors to cause LightTable to go full screen at startup:

[:app :lt.objs.app/run-on-init [:window.fullscreen]]

Add the following to Settings: User behaviors to open the console as a tab automatically at startup:

[:app :lt.objs.app/run-post-init [:console-tab]]

Note that some commands can be added to the run-on-init behavior but other commands are sensitive to start up order and will only work in the run-post-init behavior - :console-tab is an example of such a command.

How do I customize my font?

Add the following snippet to Settings: User behaviors.

[:app :lt.objs.style/font-settings "Courier New" "11"]

How do I change the default font size or zoom level?

[:app :lt.objs.app/set-default-zoom-level 2]

How do I change my tab or indent settings?

Add the following snippet to Settings: User behaviors.

;; 2 2 is tab size in spaces and spaces per indent
[:editor :lt.objs.editor/tab-settings false 2 2]

How do I display print margin/column ruler?

If you use 0.8.0-alpha or greater add this:

;; Draw a ruler at 80 chars
[:editor :lt.objs.editor/set-rulers]

;; Or specify multiple rulers
[:editor :lt.objs.editor/set-rulers [{:lineStyle "dashed" :color "#aff" :column 80}
                                     {:lineStyle "dashed" :color "#aff" :column 120}]]

How do I add pair keybindings?

To have the following characters {[(" auto pair, add the following snippet to Settings: User behaviors.

[:app :lt.objs.settings/pair-keymap-diffs]

How do I call a command every time a file is saved?

For example, to eval the whole file when a clojurescript file is saved, add the following snippet to Settings: User behaviors.

[:editor.clojurescript :lt.objs.editor.file/on-save :eval-editor]

How can I configure my proxy?

Set the $http_proxy and $https_proxy environment variables. Support for this was added in #1451.

Miscellaneous

How do I set the default Clojure version when running Instarepl outside of the context of a Clojure project?

Update plugins/clojure/runner/resources/project.clj by adding/changing :dependencies \[\[org.clojure/clojure "x.x.x" ]] where x.x.x is of course the Clojure version you want to use by default in your Instarepl sessions whenever LightTable doesn't run in the context of a Clojure project (i.e. double clicking on a shortcut on the desktop to run LightTable).

How do I connect to an external lein repl?

  1. Add lein-light-nrepl as a dependency to your project (See Clojure README section for more).
  2. Start your lein repl:

    $ lein repl :headless
    nREPL server started on port 59305 on host 127.0.0.1
    
  3. Using the command bar, execute the command Connect: Add Connection. Select the Clojure (remote nREPL) connection and specify the port from your repl session. For the above example this would be localhost:59305.

How do I show inline docs for current word?

Right click it and choose Show docs. Alternatively, use Ctrl-d which is bound to toggle docs.

How do I inspect any html element in Light Table?

Run the Dev: Open Developer Tools command, also known as :dev-inspector command. More info here

How do I style any element?

Let's say you want to customize the console fonts. If you look for the console ui, you'll see its selector is $('ul.console'). If you pull up the dev-inspector command, you can inspect the element and try some styles on it. Once you're satisfied with how it looks, transfer those styles to a css file and load the css file at startup.

How do I inspect the html of a page within a browser tab?

Open the dev-inspector. Click the console button in the lower left and type inspect($('#browser iframe').contentDocument). This will open up the inspector right to the element containing a page's html.

How do I install a custom version of a plugin i.e. an unreleased or old version?

cd to your plugins directory. If you don't know your plugins directory, execute the command App: Light Table version. From there, rm the current plugin, git clone https://github.com/USER/PLUGIN and git checkout to a specific version if desired.

What are the hotkeys on OSX?

Many (though not all) of the OS X hotkeys mentioned in the Light Table documentation use the cmd key instead of ctrl.

How do I find the keybinding for a command?

When in doubt, you can look up the key sequence by name by pressing ctrl-space (yes, it's really ctrl on this one) and then typing part of the name of the command you want to use. If a key is mapped to the command, it will be printed right below the command name in the command bar.

How do I open a new file I've created outside Light Table?

If you create a new file outside Light Table, you need to refresh your folder in order to open it with the navigator. To do this, open your workspace pane, right click on the folder that needs refreshing and select Refresh folder. Now you can open the new file with the navigator.

How do I auto-repeat keys on OSX?

If you want to press and repeatedly fire a key e.g. hjkl in Vim, execute this command in a shell defaults write com.kodowa.LightTable ApplePressAndHoldEnabled -bool false. If this doesn't work for your OSX version, you will need to globally enable it defaults write -g ApplePressAndHoldEnabled -bool false.

What are the names for keys in the keymap files?

Light Table uses Mousetrap for key-bindings. From that page:

For modifier keys you can use shift, ctrl, alt, or meta.

You can substitute option for alt and command for meta.

Other special keys are backspace, tab, enter, return, capslock, esc, escape, space, pageup, pagedown, end, home, left, up, right, down, ins, del, and plus.

Any other key you should be able to reference by name like a, /, $, *, or =.

Are there limitations to copy and paste?

On OSX yes. If you open any program with tmux or screen, there will be issues with the Pasteboard. This link also offers a solution in the form of brew install reattach-to-user-namespace and following install instructions

How do I use CodeMirror addons?

LightTable uses CodeMirror for the underlying text editor. CodeMirror provides an extensive set of addons that can provide additional features. To use a particular addon, add a :lt.objs.editor/load-addon behavior to your user.behaviors. For example, to use the matchtags.js addon which highlights a matching tag, add:

[:app :lt.objs.editor/load-addon "edit/matchtags.js"]

Note that the addon path is relative to this directory where LightTable stores CodeMirror addons. Also note that LightTable lags some behind CodeMirror so the addons you see on the CodeMirror website may not be available in LightTable yet. It's possible to download an addon and use it with the :lt.objs.plugins/load-js behavior but only if the addon can use the CodeMirror version that ships with LightTable.