Sublime text supports custom code segments. The method is very simple, but it is very useful. For a keyword, click tab and a large piece of code will come out.
1. Menu tools> New snippet...
2. There will be a template file and you can modify it.
<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>
<Content> <! The code between [CDATA [and]> </content> is the code block to be defined.
<!DOCTYPE html>
We can place the above Code segment in the block.
3. The code above has $ {1}. When you insert a code segment, the cursor will be located at $ {1} at the same time, and $ {2} can be found at the same time, click the tab key to switch to the next one.
You can also write $ {1: This} in this way. The cursor is a "this" string by default.
4. Keywords in tabtrigger are used to trigger code blocks. For example, you can write HTML5.
5. scopepadding: Specifies the file size of the code block. We can write source.html, which is usually commented out. If you want to trigger it in that way, it will be triggered.
The complete information is probably like this:
<snippet> <content><![CDATA[<!DOCTYPE html>
Sublime Text 3 custom snippet