简体   繁体   中英

How to make autocomplete class in sublime text 3?

How do I get when I type container in the sublime, this appears autocomplete : <div class="container"></div> . I had installed package, but it's not working

Thank you

Update :

I follow this tutorial : https://github.com/alienhard/SublimeAllAutocomplete/

I try in terminal windows like this : https://postimg.org/image/qt3zf3v0t/

Then, I try autocomplete in sublime, but it still does not work

In Sublime, these are known as snippets.

You can create a new one by selecting Tools > Developer > New Snippet... , where you'll find a skeleton to help define your new snippet. Based on your question, I think you'd want something like this:

<snippet>
    <content><![CDATA[
<div class="container"></div>
]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <tabTrigger>container</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <!-- <scope>source.python</scope> -->
</snippet>

The code defined inside the <![CDATA[…]]> section is the actual snippet, the full text you want the autocomplete to result in.

The tabTrigger defines the biggest word you have to type for the content to be suggested. In this case, typing a sub-word of 'container' ( c , co , con , ... container ) will trigger the content to appear in the drop-down box.

Save the file to the default location with the extension .sublime-snippet for it to take effect.

More information is available in the unofficial sublime docs .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM