2

Do you need to write a plugin for this or can you do it e.g. with the user.behaviors file?

Where can I find a tutorial and comprehensive documentation on this?

mydoghasworms
  • 18,233
  • 11
  • 61
  • 95

2 Answers2

0

LightTable uses CodeMirror for syntax highlighting.

If the language you want is one of CodeMirrors existing modes (and it's in the version of the node module that your version of LightTable is using) then you should be able to use the set-syntax command (ctrl+space then type "syntax" to find it) to apply it to the current editor. You can add the following to your user.behaviors file to associate the syntax with a given file extension:

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

If a CodeMirror mode is not available, you'll first need to write one. Here are some docs on Writing CodeMirror Modes.

RobinGower
  • 928
  • 6
  • 14
  • There is a closing square bracket missing at the end of your example :) – Shautieh Aug 16 '15 at 13:12
  • Well spotted @Shautieh, thanks! I've corrected the example. I guess I copied it from a longer list. – RobinGower Aug 17 '15 at 12:51
  • You're welcome @RobinGower. I found it out easily as I was trying to use it to add ocaml syntax highlighting to lighttable :) For the record, it's like this : [:files :lt.objs.files/file-types [{:name "Eliom" :exts [:eliom] :mime "text/x-ocaml" :tags [:editor.ocaml]}] ] – Shautieh Aug 18 '15 at 12:33
0

@RobinGower's answer works for me, eg for Jade syntax highlighting add [:files :lt.objs.files/file-types [{:name "jade" :exts [:jade] :mime "text/x-jade" :tags [:editor.jade]}] ] to the user.behaviors file

@mydoghasworms - have you already seen these pages?

I found a few helpful things on both.

Community
  • 1
  • 1
claytonrsh
  • 208
  • 2
  • 9