summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-10-19 17:06:43 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-10-19 17:06:43 +0200
commit1effee8ec18d810ba21c208c42cd8ba6b3c24391 (patch)
tree74e2fcb931fa6c5ff4929a19f2ff71dd87d7b5af
parentb069e5523ea03ca9c33040681d9844932b5d4da8 (diff)
emacs: Add e/open-line
-rw-r--r--.config/emacs/editing.el12
-rw-r--r--.config/emacs/modules/mm-keybindings.el25
2 files changed, 27 insertions, 10 deletions
diff --git a/.config/emacs/editing.el b/.config/emacs/editing.el
index 1920c91..f635705 100644
--- a/.config/emacs/editing.el
+++ b/.config/emacs/editing.el
@@ -144,4 +144,16 @@ screen after scrolling."
(interactive)
(mm-do-and-center #'cua-scroll-up))
+(defun e/open-line (arg)
+ "Insert and move to a new empty line after point.
+With prefix argument ARG, inserts and moves to a new empty line before
+point."
+ (interactive "P")
+ (end-of-line)
+ (newline-and-indent)
+ (when arg
+ (transpose-lines 1)
+ (previous-line 2)
+ (end-of-line)))
+
(provide 'editing)
diff --git a/.config/emacs/modules/mm-keybindings.el b/.config/emacs/modules/mm-keybindings.el
index dc49261..1cadcb8 100644
--- a/.config/emacs/modules/mm-keybindings.el
+++ b/.config/emacs/modules/mm-keybindings.el
@@ -63,28 +63,33 @@ the first command is remapped to the second command."
;;; Enable Repeat Bindings
+(defun mm-enable-repeat-mode ()
+ "Enable `repeat-mode' without polluting the echo area."
+ (mm-with-suppressed-output
+ (repeat-mode)))
+
(use-package repeat
- :init
- (repeat-mode))
+ :hook (after-init . mm-enable-repeat-mode)
+ :custom
+ (repeat-exit-timeout 5))
;;; Remap Existing Bindings
(mm-keymap-remap global-map
backward-delete-char-untabify backward-delete-char
- kill-ring-save e/kill-ring-save-dwim
capitalize-word capitalize-dwim
downcase-word downcase-dwim
upcase-word upcase-dwim
- mark-word e/mark-entire-word
- mark-sexp e/mark-entire-sexp
-
- transpose-chars e/transpose-previous-chars
- transpose-lines e/transpose-current-and-next-lines
-
- delete-indentation e/join-current-and-next-line)
+ delete-indentation e/join-current-and-next-line
+ kill-ring-save e/kill-ring-save-dwim
+ mark-sexp e/mark-entire-sexp
+ mark-word e/mark-entire-word
+ open-line e/open-line
+ transpose-chars e/transpose-previous-chars
+ transpose-lines e/transpose-current-and-next-lines)
(with-eval-after-load 'cc-vars
(setopt c-backspace-function #'backward-delete-char))