Sublime Text 3 automatically close HTML Tags

sublime-text-3

I've recently started using Sublime Text 3 instead of my old usual editor, Brackets. When I'm writing HTML in Brackets, I would type: (| represents the cursor)

<div>|

And Brackets would automatically generate the closing tag, like so:

<div>|</div>

If I pressed Enter after that, it would open and auto-indent the tag:

<div>
    |
</div>

I've seen several other answers that describe using a keyboard shortcut. But is there a way to do it completely automatically in Sublime Text 3?

Edit: The ability to do the second half of what I am describing is not a built-in feature of Brackets, but rather a plugin. Also, here is an example:

enter image description here

Best Answer

To get tag autocompletion (and a ton of other cool features), check out the Emmet plugin, formerly known as Zen Coding. For example, typing divTab gives you

<div>|</div>

and hitting Enter then gives you

<div>
    |
</div>

Its syntax is based on CSS selectors, so you can do quite complicated things quickly. #page>div.logo+ul#navigation>li*5>a{Item $}Tab would give you:

Emmet

Related Question