Using Emacs - 21 - web mode

Quick post today.

The video goes over web-mode - my preferred weapon for html and all the goodies you embed in an html file.

It's multi-modal so it acts sensibly regardless of wether you're editing html, css, javascript or even templates in a single file.

Note: In the video, web-mode wasn't automatically inserting quotes. I had to set hte following variable to fix this:

(setq web-mode-enable-auto-quoting t)

Giving the final configuration I'm currently using:

  (use-package web-mode
    :ensure t
    :config
	 (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
	 (setq web-mode-engines-alist
	       '(("django"    . "\\.html\\'")))
	 (setq web-mode-ac-sources-alist
	       '(("css" . (ac-source-css-property))
		 ("html" . (ac-source-words-in-buffer ac-source-abbrev))))

(setq web-mode-enable-auto-closing t)
(setq web-mode-enable-auto-quoting t)) ; this fixes the quote problem I mentioned

The web-mode documentation has more information including a nice chart of all the key bindings.

Comments

Comments powered by Disqus



Enter your email address:

Delivered by FeedBurner

Google Analytics Alternative