branch: master
commit a2bb1c488349a174ec088e538101a120e996ebc5
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
ivy.el: Add "i" and "w" as global actions
Being able to insert the current candidate into a buffer with "M-o i"
and to copy it to kill ring with "M-o w" is useful enough to be the
standard setting. Additionally, it's documentation for users not aware
of (ivy-set-actions t ...).
* counsel.el: Move `counsel-info-lookup-symbol' action from "i" to "I".
---
counsel.el | 6 +++---
ivy.el | 5 +++++
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/counsel.el b/counsel.el
index 9747aa0..4d601dc 100644
--- a/counsel.el
+++ b/counsel.el
@@ -390,7 +390,7 @@ Update the minibuffer with the amount of lines collected
every
(ivy-set-actions
'counsel-describe-variable
- '(("i" counsel-info-lookup-symbol "info")
+ '(("I" counsel-info-lookup-symbol "info")
("d" counsel--find-symbol "definition")))
(defvar counsel-describe-symbol-history nil
@@ -466,7 +466,7 @@ Update the minibuffer with the amount of lines collected
every
;;** `counsel-describe-function'
(ivy-set-actions
'counsel-describe-function
- '(("i" counsel-info-lookup-symbol "info")
+ '(("I" counsel-info-lookup-symbol "info")
("d" counsel--find-symbol "definition")))
;;;###autoload
@@ -822,7 +822,7 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and
(ivy-set-actions
'counsel-descbinds
'(("d" counsel-descbinds-action-find "definition")
- ("i" counsel-descbinds-action-info "info")))
+ ("I" counsel-descbinds-action-info "info")))
(defvar counsel-descbinds-history nil
"History for `counsel-descbinds'.")
diff --git a/ivy.el b/ivy.el
index f73ebb2..f730653 100644
--- a/ivy.el
+++ b/ivy.el
@@ -3290,6 +3290,11 @@ BUFFER may be a string or nil."
ivy--rename-buffer-action
"rename")))
+(ivy-set-actions
+ t
+ '(("i" (lambda (x) (insert (if (stringp x) x (car x)))) "insert")
+ ("w" (lambda (x) (kill-new (if (stringp x) x (car x)))) "copy")))
+
(defun ivy--switch-buffer-matcher (regexp candidates)
"Return REGEXP-matching CANDIDATES.
Skip buffers that match `ivy-ignore-buffers'."