emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master e7d6dab 185/348: counsel.el (counsel-mode): Add "C-r" bind


From: Oleh Krehel
Subject: [elpa] master e7d6dab 185/348: counsel.el (counsel-mode): Add "C-r" bindings
Date: Sat, 8 Apr 2017 11:03:52 -0400 (EDT)

branch: master
commit e7d6dab60d86902bc1acc7650daee13c0a901055
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    counsel.el (counsel-mode): Add "C-r" bindings
    
    * counsel.el (counsel-shell-command-history): New command.
    (counsel-mode): Bind "C-r" in two places to search through appropriate
    history.
    
    Fixes #689
---
 counsel.el | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/counsel.el b/counsel.el
index dde66a0..71502f5 100644
--- a/counsel.el
+++ b/counsel.el
@@ -2241,6 +2241,14 @@ And insert it into the minibuffer. Useful during
     (ivy-read "Expr: " (delete-dups read-expression-history)
               :action #'insert)))
 
+;;** `counsel-shell-command-history'
+;;;###autoload
+(defun counsel-shell-command-history ()
+  (interactive)
+  (ivy-read "cmd: " shell-command-history
+            :action #'insert
+            :caller 'counsel-shell-command-history))
+
 ;;** `counsel-esh-history'
 (defun counsel--browse-history (elements)
   "Use Ivy to navigate through ELEMENTS."
@@ -2549,9 +2557,14 @@ replacements. "
   :keymap counsel-mode-map
   :lighter " counsel"
   (if counsel-mode
-      (when (and (fboundp 'advice-add)
-                 counsel-mode-override-describe-bindings)
-        (advice-add #'describe-bindings :override #'counsel-descbinds))
+      (progn
+        (when (and (fboundp 'advice-add)
+                   counsel-mode-override-describe-bindings)
+          (advice-add #'describe-bindings :override #'counsel-descbinds))
+        (define-key minibuffer-local-shell-command-map (kbd "C-r")
+          'counsel-shell-command-history)
+        (define-key read-expression-map (kbd "C-r")
+          'counsel-expression-history))
     (when (fboundp 'advice-remove)
       (advice-remove #'describe-bindings #'counsel-descbinds))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]