Sublime Text is a powerful text editor that allows you to create snippets, which are shortcuts to writing out snippets of code you reuse frequently. Sublime Text snippet files are XML files with the .sublime-snippet file extension and are generally compatible with Textmate snippets. They’re placed in the Packages/User directory of your Sublime Text install.

Download Sublime Text Snippets

Mac OS users will find their snippets located at:

Windows users will find their snippets located at:

You can create a file in this directory called html.sublime-snippet and enter the following code to set up a default HTML document by simply typing “html” in Sublime Text:

In the above example, the code which typing the shortcut should produce is enclosed in a CDATA section and placed within the content tags. The variables such as ${1:Home} allow you to set up fields, optionally defining a default placeholder value for the field. If you don’t want to specify a default value, just use ${1} instead. The first place holder will be selected by default and ready for editing. Then each subsequent place holder can be selected by pressing the TAB button, adding the SHIFT button to go backwards. The shortcut you type to trigger the snippet is specified in the tabTrigger tag.

Snippets can be set up for HTML, JavaScript, CSS, whatever you care to set up a snippet for.

Check out our github repository out for more examples.

View the documentation for full details on the Sublime Text Snippets syntax.