branch: master commit cf2c7bccd9ecc6e9288c65337525587371f15e82 Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
Modify "M-n" prediction when region is active * ivy.el (ivy--reset-state): When the region is active and "M-n" is called, insert the region contents into the minibuffer and deactivate the region. The region deactivation is done for `swiper', to make it easier to search for multiple words or a subword. --- ivy.el | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ivy.el b/ivy.el index a5da026..f44dbdf 100644 --- a/ivy.el +++ b/ivy.el @@ -1312,10 +1312,16 @@ This is useful for recursive `ivy-read'." coll))) 0)))) (setq ivy-exit nil) - (setq ivy--default (or - (thing-at-point 'url) - (thing-at-point 'symbol) - "")) + (setq ivy--default + (if (region-active-p) + (prog1 (buffer-substring + (region-beginning) + (region-end)) + (deactivate-mark)) + (or + (thing-at-point 'url) + (thing-at-point 'symbol) + ""))) (setq ivy--prompt (cond ((string-match "%.*d" prompt) prompt)