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
(defun my.newline-and-indent ()
"Newline and indent; if in a comment, auto-comment and properly
indent the next line."
(interactive)
(cond ((sp-point-in-string)
(evil-ret))
((evil-in-comment-p)
(cond
((sp-point-in-string)
(newline))
((sp-point-in-comment)
(if (eq major-mode 'js2-mode)
(js2-line-break)
(call-interactively 'indent-new-comment-line)))
(indent-new-comment-line)))
(t
(evil-ret-and-indent))))
(newline-and-indent)
(ignore-errors (indent-sexp)))))