Sublime Text 3 custom snippet

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.