Improved newline-and-indent

This commit is contained in:
Henrik Lissner 2015-01-26 15:24:51 -05:00
parent 67cf2c9827
commit 4fbaf7b3dc

View file

@ -110,14 +110,14 @@ spaces on either side of the point if so. Resorts to
;;;###autoload ;;;###autoload
(defun my.newline-and-indent () (defun my.newline-and-indent ()
"Newline and indent; if in a comment, auto-comment and properly
indent the next line."
(interactive) (interactive)
(cond ((sp-point-in-string) (cond
(evil-ret)) ((sp-point-in-string)
((evil-in-comment-p) (newline))
((sp-point-in-comment)
(if (eq major-mode 'js2-mode) (if (eq major-mode 'js2-mode)
(js2-line-break) (js2-line-break)
(call-interactively 'indent-new-comment-line))) (indent-new-comment-line)))
(t (t
(evil-ret-and-indent)))) (newline-and-indent)
(ignore-errors (indent-sexp)))))