0

I am using Sublime text 3 build 3065 to edit HTML and PHP code. The built in HTML tag completions are awesome, just typing p and pressing tab gets you <p></p> with the cursor in the right place between the tags.

But there are some things missing, like <hr /> and some that I would like to tweak, so how do I edit or add to the autocompletions that are built into Sublime text 3?

I gather that in Sublime text 2 it was easy because they were stored in a text file, but I don't think this is the case for version 3.

thanks for any help, David

0

You should just use snippets with a appropriate tab trigger.

I personally have a snippet to insert an arbitrary HTML tag quickly:

<snippet>
    <content><![CDATA[
<$1>$0</$1>
]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <tabTrigger>t</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <scope>source.js, source.javascript, text.html</scope>
</snippet>

This is saved as t.sublime-snippet in my User directory. Note that you can create arbitrary subdirectories, the files still will be recognized by Sublime.

I press t followed by tab and write the tag name - say span - press tab again and write what's between the tags.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.