How to Create Sublime Text Snippets

Created on July 4th, 2015

Creating sublime text snippets is super easy & it can come in really handy. In this quick video we'll show you how to start creating your own sublime text snippets. In order to create a new snippet you will need to:

  1. Open up Sublime Text
  2. Goto Tools->New Snippet
  3. Modify the contents inside of the block
  4. Enable your tab trigger
  5. Save the file as filename.sublime-snippet
  6. In a new file type in the tab trigger name and press tab!

Here is an example snippet that get's generated when you click on Tools->New Snippet:

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

So, go and make your own sublime text snippets and save yourself some time and impress some friends :P

Comments (0)