Add functions to insert blank lines above and below the current line without moving the point and changing the evil state.

This commit is contained in:
syl20bnr 2013-04-18 17:21:31 -04:00
parent 678b03e879
commit 7e0a802b48
2 changed files with 19 additions and 0 deletions

View File

@ -1,3 +1,19 @@
;; insert one or several line below without changing current evil state
(defun evil-insert-line-below (count)
"Insert one of several lines below the current point's line without changing
the current state and point position."
(interactive "p")
(save-excursion
(evil-save-state (evil-open-below count))))
;; insert one or several line above without changing current evil state
(defun evil-insert-line-above (count)
"Insert one of several lines above the current point's line without changing
the current state and point position."
(interactive "p")
(save-excursion
(evil-save-state (evil-open-above count))))
;; from magnars
(defun eval-and-replace ()
"Replace the preceding sexp with its value."

View File

@ -5,6 +5,9 @@
(define-key evil-normal-state-map (kbd "j") 'evil-next-visual-line)
(define-key evil-normal-state-map (kbd "k") 'evil-previous-visual-line)
(define-key evil-insert-state-map (kbd "ESC") 'evil-normal-state)
;; insert blank lines ---------------------------------------------------------
(define-key evil-normal-state-map (kbd "M-j") 'evil-insert-line-below)
(define-key evil-normal-state-map (kbd "M-k") 'evil-insert-line-above)
;; close parens ---------------------------------------------------------------
(global-set-key (kbd ")") 'close-open-paren)
;; auto-complete --------------------------------------------------------------