Improved newline-and-indent
This commit is contained in:
parent
67cf2c9827
commit
4fbaf7b3dc
1 changed files with 10 additions and 10 deletions
|
@ -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))
|
||||||
(if (eq major-mode 'js2-mode)
|
((sp-point-in-comment)
|
||||||
(js2-line-break)
|
(if (eq major-mode 'js2-mode)
|
||||||
(call-interactively 'indent-new-comment-line)))
|
(js2-line-break)
|
||||||
(t
|
(indent-new-comment-line)))
|
||||||
(evil-ret-and-indent))))
|
(t
|
||||||
|
(newline-and-indent)
|
||||||
|
(ignore-errors (indent-sexp)))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue