From 6b7aad14fd24dc0fc71fdf699236491acd23638f Mon Sep 17 00:00:00 2001 From: Tim McCarthy Date: Tue, 16 Apr 2024 10:39:08 -0700 Subject: [PATCH] Emacs: Add Avy --- thoom-emacs/modules/thoom-editing.el | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/thoom-emacs/modules/thoom-editing.el b/thoom-emacs/modules/thoom-editing.el index a9de9a0..542b925 100644 --- a/thoom-emacs/modules/thoom-editing.el +++ b/thoom-emacs/modules/thoom-editing.el @@ -1,10 +1,33 @@ (provide 'thoom-editing) +;; TODO Support org headings and comments (defun thoom/move-to-beginnings () - "Move between the two beginnings of a line: The very beginning, and the first non-whitespace character." + "Move between the two beginnings of a line: The very beginning, + and the first non-whitespace character." (interactive "^") (if (bolp) (back-to-indentation) (move-beginning-of-line 1))) -(global-set-key (kbd "C-a") #'thoom/move-to-beginnings) + +(use-package emacs + :bind (("C-a" . thoom/move-to-beginnings))) + +;; Allow movement during isearch +;; C/M-v move to next/previous match not currently visible +;; M- move to first/last match in buffer +(setq isearch-allow-motion t) + +(use-package avy + :ensure t + :bind + (("C-j" . avy-goto-char-timer) + ([remap goto-line] . avy-goto-line)) + + :init + (avy-setup-default)) + +(use-package avy-zap + :ensure t + :bind (("C-z" . avy-zap-up-to-char-dwim) + ("M-z" . avy-zap-to-char-dwim)))