Merge pull request #572 from toctan/prelude-web

Make web-mode play nice with smartparens
This commit is contained in:
Bozhidar Batsov 2014-06-14 09:43:10 +03:00
commit b60180b9c4

View file

@ -49,16 +49,25 @@
(eval-after-load 'web-mode (eval-after-load 'web-mode
'(progn '(progn
(defun prelude-web-mode-defaults () (defun prelude-web-mode-defaults ()
;; Customizations ;; make web-mode play nice with smartparens
(setq web-mode-markup-indent-offset 4) (setq web-mode-enable-auto-pairing nil)
(setq web-mode-css-indent-offset 2) (sp-with-modes '(web-mode)
(setq web-mode-code-indent-offset 4) (sp-local-pair "%" "%"
(setq web-mode-disable-autocompletion t) :unless '(sp-in-string-p)
(local-set-key (kbd "RET") 'newline-and-indent)) :post-handlers '(((lambda (&rest _ignored)
(just-one-space)
(save-excursion (insert " ")))
"SPC" "=" "#")))
(sp-local-pair "<% " " %>" :insert "C-c %")
(sp-local-pair "<%= " " %>" :insert "C-c =")
(sp-local-pair "<%# " " %>" :insert "C-c #")
(sp-local-tag "%" "<% " " %>")
(sp-local-tag "=" "<%= " " %>")
(sp-local-tag "#" "<%# " " %>")))
(setq prelude-web-mode-hook 'prelude-web-mode-defaults) (setq prelude-web-mode-hook 'prelude-web-mode-defaults)
(add-hook 'web-mode-hook (lambda () (add-hook 'web-mode-hook (lambda ()
(run-hooks 'prelude-web-mode-hook))))) (run-hooks 'prelude-web-mode-hook)))))
(provide 'prelude-web) (provide 'prelude-web)
;;; prelude-web.el ends here ;;; prelude-web.el ends here