Using emmet-mode in Emacs for HTML Editing

When in Windows, I have a bad habit of using Sublime Text 2 instead of Emacs — I know, I’m ashamed of myself. It has some very useful features that I’ve really gotten used to using. Among them is the HTML dom shorthand… an example, if I type:

hr.margin-none <TAB>

Then it automatically expands to:

<hr class="margin-none"></hr>

Very useful when typing the code out yourself and not using a GUI editor… so I wanted to see if this functionality was available in Emacs. The good folks over at StackOverflow were quick to answer my question, and now I’ve been introduced to emmet-mode. It works the same, except by default the key binding to cause the expand is C-j, instead of TAB in Sublime Text. I think making a local emmet-mode keybinding may take care of this, but I’ve not played around with it enough yet. You can get emmet-mode from marmalade or MELPA repositories.


Leave a Reply