diff --git a/my-funcs.el b/my-funcs.el index 6f4a2c18b..53fcb9283 100644 --- a/my-funcs.el +++ b/my-funcs.el @@ -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." diff --git a/my-keybindings.el b/my-keybindings.el index 36ed0cf7d..c584e07ae 100644 --- a/my-keybindings.el +++ b/my-keybindings.el @@ -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 --------------------------------------------------------------