Skip to content

Instantly share code, notes, and snippets.

@letuananh
Created January 11, 2017 06:53
Show Gist options
  • Save letuananh/1fffac24e1d0a76892d39d0509a8c7d4 to your computer and use it in GitHub Desktop.
Save letuananh/1fffac24e1d0a76892d39d0509a8c7d4 to your computer and use it in GitHub Desktop.

Revisions

  1. letuananh created this gist Jan 11, 2017.
    21 changes: 21 additions & 0 deletions .emacs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    ;; download web-mode.el from http://web-mode.org/ and save it to ~/.emacs.d/custom-mode
    ;; (You may need to create that directory)
    ;; Add these following lines to ~/.emacs
    (add-to-list 'load-path "~/.emacs.d/custom-mode")

    (require 'web-mode)
    (add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
    (add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
    (add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode))
    (add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
    (add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
    (add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
    (add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
    (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))

    ;; Indentation for web-mode.el
    (setq web-mode-markup-indent-offset 2)
    (setq web-mode-css-indent-offset 2)
    (setq web-mode-code-indent-offset 2)

    ;; [3] Now restart Emacs, edit an HTML file and then M-x RET web-mode