IC
This commit is contained in:
@@ -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))
|
||||
Reference in New Issue
Block a user