-
Notifications
You must be signed in to change notification settings - Fork 26
Restrict to visual selection (Enhancement) #4
Copy link
Copy link
Open
Description
We have 'iedit-restrict-function and 'iedit-restrict-current-line (even 'iedit-expand-down-a-line and 'iedit-expand-up-a-line), and iedit has 'iedit-restrict-region but it isn't interactive. It'd be nice to exploit evil's visual mode to restrict matches to a selected region.
I have an implementation of this in my emacs.d that maps SPC (in visual mode) to the following lambda:
(lambda ()
(interactive)
(if (iedit-current-occurrence-string)
(let ((current-prefix-arg '(4)))
(iedit-done)
(call-interactively 'iedit-mode)
(save-excursion (iedit-restrict-region (region-beginning) (region-end)))
(evil-previous-line))
(call-interactively 'evil-ret))))))Unfortunately, while this does cut down on matches, it won't add new matches to an expanded restricted region (yet).
EDIT: Now it does, updated the lambda.
I can extract it into, say, a 'evil-iedit-restrict-region, for a PR if this interests you.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels