diff --git a/emacs/init.org b/emacs/init.org index 22bc838..5d9ac0a 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -1335,6 +1335,23 @@ Smartparens enables structured editing of s-expressions and other pairs: (leader-def-key "lb" 'sp-forward-barf-sexp) #+END_SRC +Enable ES6 arrow functions in web-mode ("borrowed" from [[https://github.com/Fuco1/smartparens/issues/823#issuecomment-403019519][this GitHub comment]]): +#+BEGIN_SRC emacs-lisp + (defun sp-after-equals-p (_id action _context) + (when (memq action '(insert navigate)) + (sp--looking-back-p "=>" 2))) + + (defun sp-after-equals-skip (ms mb _me) + (when (eq ms ">") + (save-excursion + (goto-char mb) + (sp--looking-back-p "=" 1)))) + + (sp-local-pair '(web-mode) "<" nil + :unless '(:add sp-after-equals-p) + :skip-match 'sp-after-equals-skip-p) +#+END_SRC + Parinfer infers parens from indentation and vice-versa: #+BEGIN_SRC emacs-lisp (use-package parinfer