John
John

Reputation: 131

Change HTML + Tab autocomplete (Sublime Text 2)

When you type out the word like so
enter image description here

and then press tab it autocompletes to something like so...

Autocompleted Image
But I want it to look something more along the lines of this

enter image description here

Upvotes: 2

Views: 2572

Answers (1)

zkent
zkent

Reputation: 980

This is one of Sublime's built in snippets. You can edit the default one or create a new one. To edit the existing,

  • Preferences > Browse Packages
  • Open HTML folder
  • Edit html.sublime-template

The default snippet is below:

<snippet>
    <content><![CDATA[<html>
<head>
    <title>$1</title>
</head>
<body>
$0
</body>
</html>]]></content>
    <tabTrigger>html</tabTrigger>
    <scope>text.html</scope>
</snippet>

The content you want to edit is between <![CDATA[ and ]]>. The $0 and $1 variables are placeholders for content and once Sublime Text renders the snippet, you can move between the placeholders by pressing tab.

Upvotes: 3

Related Questions