2

I've been using Emmet in Sublime Text for a long time. Now I like to insert my own commands to make it even faster.

For example, if I type this:

block

and then press tab I want it to expand into this:

<div class="block">
  <div class="text">
     <h3>|</h3>
     <p></p>
  </div>
</div>

And, if possible, I'd like it to immediately begin where the | is placed.

You can see it as some kind of preset.

I've also been messing with the directory, but I don't want to do that on my own unless I might mess things up.

Is this possible?

2 Answers2

2

I don't know very much sublime text but looks like you're searching for the snippet package http://www.hongkiat.com/blog/sublime-code-snippets/

JC0nde
  • 36
  • 7
2

Open snippets.json (look for it under Emmet installation directory) and hit Ctrl+F to search for "html": Inside of "html" you will find "snippets" property - this is where you should add your custom snippets (don't forget to add comma (,) at the end of the previous snippet):

"block": "<div class=\"block\">\n\t<div class=\"text\">\n\t\t<h3>|</h3>\n\t\t<p></p>\n\t</div>\n</div>"

You can also find more details about custom Emmet snippets on their website: http://docs.emmet.io/customization/snippets/

Goran Vasic
  • 1,079
  • 10
  • 11