branch: master commit 4645e89fd414f799ea2f8082ede081e33a6000ab Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
swiper.el (swiper-action-copy): Add and bind to "M-o w" Re #2260 --- swiper.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/swiper.el b/swiper.el index af60c5c..11c4bce 100644 --- a/swiper.el +++ b/swiper.el @@ -1430,6 +1430,16 @@ that we search only for one character." (ivy-state-window ivy-last)))) (swiper--cleanup))) +(defun swiper-action-copy (_x) + "Copy line at point and go back." + (kill-new + (buffer-substring-no-properties + (line-beginning-position) (line-end-position))) + (goto-char swiper--opoint)) + +(ivy-add-actions 'swiper-isearch '(("w" swiper-action-copy "copy"))) +(ivy-add-actions 'swiper '(("w" swiper-action-copy "copy"))) + (defun swiper-isearch-thing-at-point () "Insert `symbol-at-point' into the minibuffer of `swiper-isearch'. When not running `swiper-isearch' already, start it."