Sublime Text–Sublime?

I 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.

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,

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 is an independent consultant and programmer with three decades of experience writing and delivering software projects. He is the author of 2 dozen books and multiple Pluralsight courses, and has been 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 Xamarin Certified Mobile Developer and a Xamarin MVP, Microsoft MVP and Telerik MVP.

9 Responses to Sublime Text–Sublime?

Thanks for your marvelous posting! I really enjoyed reading it, you may be a great author.
I will remember to bookmark your blog and will eventually come back later on.
I want to encourage one to continue your great writing,
have a nice evening!

Simply desire to say your article is as amazing. The clarity in your post is simply nice and that i could assume you’re
knowledgeable in this subject. Fine with your permission let me to take hold of your RSS feed to stay updated with imminent post.
Thanks one million and please continue the enjoyable work.

I’m at the same stage as you. This weekend I purchased the following from leanpub (i am not affiliated with the book/author/publisher/anyone in any way) to help me get started. It is early yet but it seems pretty promising so far and may help you…

The ultimate resource to learn sublime can be found on NetTuts. Jeffery Way does an excellent job demonstrating some really cool tricks. I really love Sublime but i wish there was better solution for a Powershell console within. I came across one but am not able to successfully get it going. Excited to see what new things i get to learn from your experiences.

I have been using Notepad++ for years, and I am still using it but Sublime is really better for presentations and his short-keys make him more useful than Notepad++
You just have to spend some time to configure it as you like and after that you have all in one, some short-keys from resharper some from Visual Studio and you work with HTLM like real pro.

Jesse: I agree with your sentiments about Sublime Text (although I’m just using v2 at the moment; I don’t want to use v3 until it’s a lot more stable and/or released). It’s great for writing client-side code (HTML/CSS/JS). A while back I was writing some Markdown files and got Sublime Text 2 to update Firefox’s view of the Markdown preview. Here’s the blog post on the subject, because you soon find yourself in a maze of twisty little passages, all alike.