From c3dd2dc1ca1ddf3771d1bbc733fd7aa3e8c6835d Mon Sep 17 00:00:00 2001 From: yuzu-eva Date: Sat, 28 Oct 2023 22:05:28 +0200 Subject: feature: added function to insert newline above/below similar to vim --- config.org | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/config.org b/config.org index f41f6b8..f9890e2 100644 --- a/config.org +++ b/config.org @@ -426,6 +426,28 @@ Taken from [[http://xahlee.info][Xah Lee]]. (re-search-forward (regexp-opt xah-right-brackets) nil t)) #+end_src +** Insert newline above/below + +Inserts a newline above or below, like O and o in vim + +#+begin_src emacs-lisp + (defun newline-above () + "Inserts a new line above current line and moves cursor to that position" + (interactive) + (beginning-of-line) + (newline-and-indent) + (previous-line) + (indent-relative)) + (global-set-key (kbd "M-O") 'newline-above) + + (defun newline-below () + "Inserts a new line below current line and moves cursor to that position" + (interactive) + (end-of-line) + (newline-and-indent)) + (global-set-key (kbd "M-o") 'newline-below) +#+end_src + * Use-Package section ** Initialize =dashboard= -- cgit v1.2.3