summaryrefslogtreecommitdiff
path: root/config.org
diff options
context:
space:
mode:
authoryuzu-eva <stevenhu@web.de>2023-10-28 22:05:28 +0200
committeryuzu-eva <stevenhu@web.de>2023-10-28 22:05:28 +0200
commitc3dd2dc1ca1ddf3771d1bbc733fd7aa3e8c6835d (patch)
tree695ae9ba057728eea74fe5821c677ada09bb845a /config.org
parent02082e0ab611d4b3c4a26a71d93260860254cdbb (diff)
feature: added function to insert newline above/below similar to vim
Diffstat (limited to 'config.org')
-rw-r--r--config.org22
1 files changed, 22 insertions, 0 deletions
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=