Sublime Text for LISP

Finding the Right Text Editor for LISP

Every beginning of the year, it is a time for me when I’m trying to optimize my workflows. LISP coding is one of my fields of interests in this case. I was using VLIDE for years, but since I started to test my code for BricsCAD, it became not so comfortable, and last year I decided to find the right text editor for my needs. After downloading of any new text editor for evaluation, I was checking three items of functionality only and those items were syntax highlighting, brackets matching and double-click selection, including brackets, for code loading. Sure, probably every text editor can handle this basic functionality and for this reason I evaluated lots of them. Finally I have made my choice on Sublime Text 3 - the text editor which fully fits into my needs and works in my manner what I like. And of course, everything said herein is in my own opinion only and may not work for others in the best way. Anyway, I would like to share with my findings to the Community.

Syntax highlighting

I started from the “lisp” syntax definition which was builtin to Sublime Text. Naturally, it was not dedicated to the LISP for CAD and required for modifications. Finally I simplified it and rewrote in YAML, format which is used in Sublime Text 3. It’s still not perfect but syntax looks like in a picture below for now.

LISP syntax in Sublime Text
vle-extension.lsp source in Sublime Text

Note, single line and inline/multiline comments are supported in the case if comment symbols will be added manually, but commenting of multiline selection using Sublime’s shortcut Ctrl+/ - group of triple semicolon will be added as a comment mark before every line. And DCL syntax is not supported yet because I do not use DCLs in my lispworks. So, there is still a big field for improvements.


Sublime Text supports plenty of Packages and Themes provided by the Community and their installation using Package Control is quite easy. You can simply browse the library and find your own collection of useful Packages, however here is one Must have Package for every LISPer - BracketHighlighter for bracket matching. Dependent on User settings, it can highlight contents in various styles, including underlining, outlining, solid and more. In my own definition it looks like in this image.

vle-extension.lsp with BracketHighlighter

Key Bindings and Commands

In Sublime Text it is possible to use lots of predefined shortcuts, redefine them or create custom shortcuts and commands for individual needs. In the beginning I have mentioned about my habit to select code with mouse including brackets. The standard shortcut provided by Sublime text Ctrl+Shift+M was not usable for me because it required double hitting on M for selection of code including brackets. Double-click using mouse also did not helped, because it selects word or word within brackets. The solution was found when I decided to create a new command for code selection including brackets, then copy it to clipboard - with the help at forum I defined it as a triple-click. So, for now the code loading or debugging is quite simple: I split my desktop into two parts - for Sublime Text and BricsCAD’s TextScreen, triple-click on the code within brackets and paste this copied content within TextScreen. I have added this command for download if someone will like use it too.


Snippets are predefined templates of code parts and may be inserted and managed by hitting TAB and Enter keys. For example, my defun function looks and works in the next way:

After typing def and pressing TAB, the template of defun function is inserted

Sublime Text snippet
Sublime Text snippet

Next, by editing selection and hitting TAB, it is possible to leave or delete c:, to type a function name and a comment at the end with the same name, to start coding and to leave or delete the last (princ). The code for this defun snippet is listed below:

*(defun ${1:c:}vg:${2:} (/)-*

 ; ${1/\*//}vg:${2/\*//}
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <!-- Optional: Set a scope to limit where the snippet will trigger -->

What’s very nice - it is not required to reload Sublime Text to accept updates. You can replace my initials within defun snippet to yours and to use it instantly after saving snippet’s definition. I have added some of my snippets for download, anyway, since I think this kind of definition depends on individual choices how code must look, it’s a good field for playing to everyone.

Build Systems

It is possible to create a buil system for any kind of files. For example, here is a definition to run DEScoder.exe to compile LSP file from Sublime Text window:

"cmd": ["C:\Program Files\Bricsys\BricsCAD V17 en_US\DESCoder.exe", "$file"]

I do not use this file for myself because I’m using VLIDE for VLX and DES compilation at the same time. By the way, this is the only reason I’m still using VLIDE…

Cross platform solution

Sublime Text is a cross platform solution and it works on Windows, Linux and Mac OS. Even more, it is possible to transfer settings, themes, snippets and etc. from one platform to another. I was very excited when simply copied my User folder from Windows to Linux and Mac and everything was working as expected, and I was able to work without any kind of redefinition. Note, user defined Key Bindings may not be compatible to all platforms due to different control keys, but it was not important in my own case.

User folder path

  • Windows: C:\Users{UserName}\AppData\Roaming\Sublime Text 3\Packages\User\
  • Linux: /home/{username}/.config/sublime-text-3/Packages/User/
  • Mac: /Users/{UserName}/Library/Application Support/Sublime Text 3/Packages/User/


One more great point I found about Sublime Text is approach for Licensing. Sublime Text is Licensed per user, not per computer. So, I can test my code on every platform, on several computers and without additional expenses. The single License costs for 70$ and in my point of view it worth.

Download Sublime files for LISP

I’ve added some files mentioned within this text into a single archive for your download and testing. It is not a Package which is downloadable using Package Control and it does not require any kind of installation. Simply unpack this archive into …/Packages/User/ folder, open LISP source file and set it’s syntax from pulldown menu: View->Syntax->User->LISP. And have a lot of fun with coding in LISP using Sublime Text - the Text Editor I have felt in love with during the last year!

Download LISP archive for Sublime Text.

Finally, I really like using of Sublime Text not only for my LISP coding, but I use it for every textwork I do and it works for me!

Leave a Reply

Your email address will not be published. Required fields are marked *