This article refers to http://www.blogjava.net/Hafeyang/archive/2012/08/17/how_to_create_code_snippet_in_subline_text_2.html
For front-end engineers, the basic structure of writing an HTML page is manual work, and every time you copy a problem, sublime text 2 provides a good code snippet for reuse. The procedure for creating a HTML5 code fragment is described below.
On the menu, click Tools, New Snippet, (Tools---code snippet) to create a new XML File tab:
<snippet>
<content><! [cdata[
Hello, ${1:this} is a ${2:snippet}.
]]></content>
<!--Optional:set a tabtrigger to define what to trigger the snippet-
<!--<tabTrigger>hello</tabTrigger>--
<!--Optional:set a scope to limit where the snippet would trigger--
<!--<scope>source.python</scope>--
</snippet>
The comments have been described in more detail.
Content inside is the code template: ${Sequence Number: The default value}, the same number of places the cursor will be stopped at the same time can be edited in many places. The ordinal size is tabindex. When you actually use the code, you can use tab to toggle the cursor position.
Tabtrigger is when you enter the string and the tab is the content of the cursor that is inserted in content.
Scope refers to which file types are used.
Here is the definition of the HTML5 code fragment:
<snippet>
<content><! [cdata[
<!doctype html>
<meta charset= "Utf-8" >
<title>${1}</title>
<body>
Hello, ${2:this} is a ${3:snippet}.
</body>
]]></content>
<!--Optional:set a tabtrigger to define what to trigger the snippet-
<tabTrigger>html5</tabTrigger>
<!--Optional:set a scope to limit where the snippet would trigger--
<!--<scope>source.python</scope>--
</snippet>
Save the default save path as c:\users\[user]\appdata\roaming\sublime Text 2\packages\user\html5.sublime-snippet (Win7) after editing is done. The suffix must be. Sublime-snippet.
After you save the restart Sublime Text 2, create a new file: Enter Html5,tab The following effect appears:
${1} appears two times, so the cursor edits two of the graphs simultaneously.
${2:this}, the This default value appears at 2. ${1} at the end of the Edit press TAB to ${2}.
OK, that's all.
Sublime Text 2 custom code snippet