diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-11-18 12:13:23 +0100 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-11-18 12:13:23 +0100 |
commit | d7c1c75c86592d998f53dbc42c10ff664b79a329 (patch) | |
tree | c960f01b2bf9ce0e675c73aad079a410be15fbc6 /.config/emacs/modules/mm-editing.el | |
parent | 8d0095ee5d9c9a6594edc2618fef1d4a3d0ad7d3 (diff) |
emacs: Move text
Diffstat (limited to '.config/emacs/modules/mm-editing.el')
-rw-r--r-- | .config/emacs/modules/mm-editing.el | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/.config/emacs/modules/mm-editing.el b/.config/emacs/modules/mm-editing.el index 5072366..c32776f 100644 --- a/.config/emacs/modules/mm-editing.el +++ b/.config/emacs/modules/mm-editing.el @@ -226,6 +226,24 @@ forces that to not happen." :commands (increment-number-at-point decrement-number-at-point)) +;;; Move Line or Region + +(defun mm-move-text-indent (&rest _) + (let ((deactivate deactivate-mark)) + (if (region-active-p) + (indent-region (region-beginning) (region-end)) + (indent-region (line-beginning-position) (line-end-position))) + (setq deactivate-mark deactivate))) + +(use-package move-text + :ensure t + :bind (("M-n" . move-text-down) + ("M-p" . move-text-up)) + :config + (dolist (command #'(move-text-up move-text-down)) + (advice-add command :after #'mm-move-text-indent))) + + ;;; Surround With Delimeters (defun mm-editing-surround-with-spaces (char) |