From 9071ade61be2db17277095e7f1abba6322a39dfd Mon Sep 17 00:00:00 2001 From: Tim McCarthy Date: Fri, 20 Sep 2024 22:52:57 -0700 Subject: [PATCH] Fully working mwim config - Enable in org-mode and visual-line-mode - Configure visual line stops as first options --- thoom-emacs/modules/thoom-editing.el | 23 ++++++++++++++++++++--- thoom-emacs/modules/thoom-org.el | 6 ++++-- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/thoom-emacs/modules/thoom-editing.el b/thoom-emacs/modules/thoom-editing.el index 0d338e2..5afc656 100644 --- a/thoom-emacs/modules/thoom-editing.el +++ b/thoom-emacs/modules/thoom-editing.el @@ -3,12 +3,29 @@ (use-package mwim :ensure t :bind (([remap move-beginning-of-line] . mwim-beginning) - ([remap move-end-of-line] . mwim-end)) + ([remap move-end-of-line] . mwim-end) + :map visual-line-mode-map + ("C-a" . mwim-beginning) + ("C-e" . mwim-end)) + :init + (defun mwim-visual-line-end () + (mwim-point-at + (end-of-visual-line))) + (defun mwim-visual-line-beginning () + (mwim-point-at + (beginning-of-visual-line))) :custom (mwim-beginning-position-functions - '(mwim-line-beginning + '(mwim-visual-line-beginning + mwim-line-beginning mwim-code-beginning - mwim-comment-beginning))) + mwim-comment-beginning)) + (mwim-end-position-functions + '(mwim-visual-line-end + mwim-block-end + mwim-code-end + mwim-line-end))) + ;; Allow movement during isearch ;; C/M-v move to next/previous match not currently visible diff --git a/thoom-emacs/modules/thoom-org.el b/thoom-emacs/modules/thoom-org.el index 3a741e6..6dff2a6 100644 --- a/thoom-emacs/modules/thoom-org.el +++ b/thoom-emacs/modules/thoom-org.el @@ -4,9 +4,11 @@ :bind (("C-c o ," . thoom/org-clear-all) ("C-c o s" . org-screenshot) ("C-c SPC" . org-table-blank-field) - ;; Unbind to make room for avy + ;; Unbind to make room for avy and mwim :map org-mode-map - ("C-j" . nil)) + ("C-j" . nil) + ("C-a" . mwim-beginning) + ("C-e" . mwim-end)) :hook ((org-mode . visual-line-mode)) :custom (org-special-ctrl-a/e 'reversed)