This commit is contained in:
Your Name
2026-05-10 01:05:57 +02:00
commit f3cb5a6e26
19 changed files with 2741 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
;;; ../../lyfi/configs/apps/doom/custom/avy-region.el -*- lexical-binding: t; -*-
(defun my/avy-region (jump-fn &optional inclusive)
"Select region between two points chosen with JUMP-FN.
JUMP-FN is a command like `avy-goto-char-timer' or `avy-goto-line'.
When INCLUSIVE is non-nil, include the character at the end point."
(interactive)
(let (p1 p2)
(cl-labels ((do-jump () (call-interactively jump-fn) (point)))
(setq p1 (do-jump))
(setq p2 (do-jump)))
(when (and p1 p2)
(let ((beg (min p1 p2))
(end (max p1 p2)))
(push-mark beg nil t)
(goto-char end)
(when inclusive
(unless (eobp) (forward-char 1)))))))
(defun my/avy-char-region ()
"mark region between 2 chars using avy-char"
(interactive)
(my/avy-region 'avy-goto-char-timer t))
(defun my/avy-line-region ()
"mark region between 2 lines using avy-line"
(interactive)
(my/avy-region 'avy-goto-line)
(forward-line 1))