Use the sublime snippet function to quickly create a code segment.
In front-end development, we often enter the same basic code, such as common jquery references, bootstrap frameworks, and cssreset. If you copy and paste the code at each time, here is a more concise method.
Use the sublime snippet function to quickly create a code segment
Open Tools> New snippet and we can see the content.
If I have no basic English skills, I am a little confused. Today I will introduce how to use this super function.
First, we will briefly introduce the components of snippet:
content
: It must contain<![CDATA[…]]>
Otherwise, it cannot work and contains the code segment you want to use. The code segment shown on this page is Hello, this is a snippet. $ {1: this} indicates that the cursor is placed behind this after the code segment is obtained. $ {2: snippet} indicates that the cursor will jump from this to snippet after the Tab key is pressed, these are all for easy input of subsequent code. If the code segment you want to paste does not need to be modified, you can ignore these
tabTrigger
: The character or string used to trigger the code snippet. For example, in the preceding example, enterhello
Press the tab and the code snippet "Hello, this is a snippet." will be output in the editor.
scope
: Indicates that your code snippet will be activated in that language environment. For example, the above Code definessource.python
This code snippet will be activated in the python environment.
Now, let's show the code segments that I often use.
After this setting, enter jquery in the html page and press the Tab key to quickly obtain the code segment in snippet, that is
<Script src = "http://apps.bdimg.com/libs/jquery/1.9.0/jquery.min.js"> </script>
How are you doing? It's fast enough! You no longer need to type so many codes.
Css can also be used in this way.
This is my pc-side cssreset code segment, so that I only need to enter cssresetpc In the css page, and then press the Tab key to get the cssreset.
I can't do it any more quickly. Do you understand?