Make web-mode play nice with smartparens
web-mode's auto paring is in conflict with smartparens. With smartparens, since the closing '>' is inserted right after the opening '<' and web-mode is not aware of that, the extra closing '>' would be inserted. That's very annoying.
This commit is contained in:
parent
f73e348534
commit
207ec885db
1 changed files with 16 additions and 2 deletions
|
@ -49,11 +49,25 @@
|
|||
(eval-after-load 'web-mode
|
||||
'(progn
|
||||
(defun prelude-web-mode-defaults ()
|
||||
)
|
||||
;; make web-mode play nice with smartparens
|
||||
(setq web-mode-enable-auto-pairing nil)
|
||||
(sp-with-modes '(web-mode)
|
||||
(sp-local-pair "%" "%"
|
||||
:unless '(sp-in-string-p)
|
||||
: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)
|
||||
|
||||
(add-hook 'web-mode-hook (lambda ()
|
||||
(run-hooks 'prelude-web-mode-hook)))))
|
||||
(run-hooks 'prelude-web-mode-hook)))))
|
||||
|
||||
(provide 'prelude-web)
|
||||
;;; prelude-web.el ends here
|
||||
|
|
Loading…
Reference in a new issue