Sublime Text–Sublime?

This is a very preliminary review of my new text editor: Sublime 3

Sublime 2I bought Sublime because I needed a very fast, lightweight text editor that supported code snippets.  I will use it primarily when teaching, presenting, etc. on Kendo and other HTML5-related topics. 

I’m not sure where else I’ll use it, though the Sublime site says that it is terrific for “code, markup and prose.”   We’ll see about that.

Note, I did buy it.  It has an unlimited trial, but I’m using it every day, and I believe strongly that programmers should be paid for their work.  It is a very reasonable $70, and licenses are per user, which means I’m free to use it on as many computers as I like. (NB: their FAQ says “Licenses purchased for Sublime Text 3 do not expire, however an upgrade fee will be required for Sublime Text 4.”). 

First Impressions

First, and most important, it is fast.  It loads in zero time.  Everything about it is fast, including working with snippets and manipulating code.

It does have a lot of nice code manipulation features, as represented by the animation shown on Sublime’s home page.  That said, figuring out how to accomplish all of them is non-trivial, especially since the official documentation is light,  and the unofficial documentation — while more extensive — is not that much better.

One of the main attractions is snippets.  They are pretty easy to create, very easy to use and easy to organize.  

To create a snippet, you  create some code,

<script type="text/javascript">
$(document).ready(function() {

});
</script>

Copy it to the clip board and choose Tools->New Snippet.  That opens a file with the snippet xml, ready for you to fill in the details,

<snippet>
    <content><![CDATA[
Hello, ${1:this} is a ${2:snippet}.
]]></content>
    <!-- Optional: Set a tabTrigger to define how to 
               trigger the snippet -->
    <!-- <tabTrigger>hello</tabTrigger> -->
    <!-- Optional: Set a scope to limit where the snippet 
               will trigger -->
    <!-- <scope>source.python</scope> -->
</snippet>

In this case, you’d replace the line beginning with “Hello” with our block of code.  You’d also delete the comments around the tabTrigger and set the text you want to use to trigger the snippet. Triggering means you type the word and hit tab, and the trigger is replaced with the snippet.  You can also add a description and possibly also set the scope.  Finally, you save the snippet to its own file, which must have the extension “sublime-snippet.”  It is one snippet per file.

That’s the bad news: what a bother.  The good news is that the snippets work incredibly well, are incredibly fast and you can bring up the snippet manager to review what snippets you have if you forget,

snippet manager

Plug-ins to the Rescue

Even better, Sublime supports plugins.  The first plugin to get is Package Control which makes adding other plugins a snap.  I found SnippetManager searching that site.  It has a git address, and PackageManager was happy to use that address to install the plug-in.  Now when I want to add a snippet, I mark the text and hit control-alt-p and start typing “Make”  — this immediately finds “Make Snippet.” Clicking that puts my text into a snippet and opens a prompt at the bottom of the page for me to fill in the trigger, the description and the file name (it already has the file ending).  Thus, making new snippets becomes a breeze.

Unfortunately, this only works in Sublime Text 2 right now.  And the latest version (though still in beta) is Sublime Text 3.  3 has a lot of nice new features (it is faster, and completes your tags, and much more).  So it is a tradeoff.  At least for now.

Projects

Projects are very weird in Sublime Text.  They seem important, and there are commands to add folders to projects, to switch projects, to Quick Switch Projects, and much more.  In fact, there is a Project menu item.  What doesn’t exist, however, is a “Create Project” option.  Apparently, you have to create a folder in Windows Explorer, add a file to that folder, and then add that folder to your project.

It is clear that projects will help organize your files, but it is also clear that it is very easy for a single project to become the repository of everything.  More on projects in a later report.

The Sublime Religion

A lot of the cool kids on the programming block are using Sublime, and I value their opinions and their perspective.  In coming days I’m sure I’ll get more than a few comments on this blog post (“hey dummy, here’s how you do projects…”) and I’ll continue to work with Sublime and get back to you about what I learn.

About Jesse Liberty

Jesse Liberty has three decades of experience writing and delivering software projects and is the author of 2 dozen books and a couple dozen online courses. His latest book, Building APIs with .NET will be released early in 2025. Liberty is a Senior SW Engineer for CNH and he was a Senior Technical Evangelist for Microsoft, a Distinguished Software Engineer for AT&T, a VP for Information Services for Citibank and a Software Architect for PBS. He is a Microsoft MVP.
This entry was posted in Opinion, Tools and Utilities and tagged . Bookmark the permalink.

9 Responses to Sublime Text–Sublime?

Comments are closed.