web-mode.el is an Emacs major-mode for editing web templates; it supports many features including syntax highlighting, smart indentation, compatibility with many template engines, comment and uncomment, etc. Since web-mode is a single file, just place it in your personal lisp files to install it. Like ~/.emacs.d/site-lisp. Add the following code in ~/.emacs to init it:
Set file extensions to relate them with web-mode:
That’s all needed steps to install web-mode.el. Personally, I set indent rules for eye candy:
I also set some syntax colors:
You can check the website of web-mode to set your own perferred settings. web-mode lets HTML editing in Emacs more productive.