Replace personal C-a hack with mwim

This commit is contained in:
2024-09-16 13:46:21 -07:00
parent b005841750
commit f63b507f07

View File

@@ -1,19 +1,20 @@
(provide 'thoom-editing)
;; TODO Support comments
(defun move-to-beginnings ()
"Move between possible beginnings of a line:
The very beginning, the start of an org headline, and the first non-whitespace character."
(interactive "^")
(cond
((not (bolp))
(move-beginning-of-line 1))
((org-at-heading-p)
(search-forward-regexp "*+ *" nil t))
(t (back-to-indentation))))
(use-package emacs
:bind (("C-a" . move-to-beginnings)))
(use-package mwim
:ensure t
:bind (([remap move-beginning-of-line] . mwim-beginning)
([remap move-end-of-line] . mwim-end))
:init
(defun thoom/mwim-org-heading-beginning ()
(mwim-point-at
(move-beginning-of-line nil)
(skip-syntax-forward "_ " (line-end-position))))
:config
(setq mwim-beginning-position-functions
'(mwim-code-beginning
thoom/mwim-org-heading-beginning
mwim-comment-beginning
mwim-line-beginning)))
;; Allow movement during isearch
;; C/M-v move to next/previous match not currently visible