Reader small image

You're reading from  Mastering Sublime Text

Product typeBook
Published inDec 2013
PublisherPackt
ISBN-139781849698429
Edition1st Edition
Right arrow
Author (1)
Dan Peleg
Dan Peleg
author image
Dan Peleg

Dan Peleg is an accomplished software engineer. As a former developer in the Israeli Intelligence Force, he holds extensive experience in both defense and robotic industries, and has previously lectured at DefCon conventions. Dan has developed unique algorithms for robotic platforms, specializes in a variety of software platforms, and currently works as the CTO for an American startup company.
Read more about Dan Peleg

Right arrow

Understanding your first snippet


We learned that snippets can be very helpful, so how about creating our own? We'll make an awesome HTML snippet, better than the one in the preceding example. First, let's have a look at how snippets work in more detail.

How do snippets work?

Snippets can be saved under any package folder, but we'll start with saving our snippets under Packages/User. Snippets must live in a Sublime package.

File format and syntax

Snippets are simple XML-formatted files with the extension sublime-snippet. The root XML tag will always be <snippet> and will then contain the following:

  • Content: This tag represents the actual snippet.

    • If we want to write $, we'll need to escape it with \$.

    • For indentation, use tabs only. If the translate_tabs_to_spaces option is set to true, tabs will be transformed to spaces automatically when the snippet is inserted.

    • The Content tag must contain the <![CDATA[…]]> section. Snippets won't work if we won't do it.

    • Also, the Content tag cannot...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Mastering Sublime Text
Published in: Dec 2013Publisher: PacktISBN-13: 9781849698429

Author (1)

author image
Dan Peleg

Dan Peleg is an accomplished software engineer. As a former developer in the Israeli Intelligence Force, he holds extensive experience in both defense and robotic industries, and has previously lectured at DefCon conventions. Dan has developed unique algorithms for robotic platforms, specializes in a variety of software platforms, and currently works as the CTO for an American startup company.
Read more about Dan Peleg