]> code.delx.au - gnu-emacs-elpa/commitdiff
Use Ivy to browse eshell and shell history entries
authormanuel-uberti <manuel@boccaperta.com>
Mon, 4 Apr 2016 09:01:32 +0000 (11:01 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Wed, 13 Apr 2016 15:58:20 +0000 (17:58 +0200)
counsel.el

index 4620c1e0f046d2c2e63adb51665f44f54106363f..76daf6d94d7841224e65fc08f8c85582f37ae33c 100644 (file)
@@ -1896,6 +1896,27 @@ And insert it into the minibuffer. Useful during
     (ivy-read "Expr: " (delete-dups read-expression-history)
               :action #'insert)))
 
+(defun browse-history (elements)
+  "Use Ivy to navigate through ELEMENTS."
+  (setq ivy-completion-beg (point))
+  (setq ivy-completion-end (point))
+  (ivy-read "Symbol name: "
+            (delete-dups
+             (ring-elements elements))
+            :action #'ivy-completion-in-region-action))
+
+;;;###autoload
+(defun counsel-esh-history ()
+  "Browse Eshell history."
+  (interactive)
+  (browse-history eshell-history-ring))
+
+;;;###autoload
+(defun counsel-shell-history ()
+  "Browse shell history."
+  (interactive)
+  (browse-history comint-input-ring))
+
 ;;* Misc OS
 ;;** `counsel-rhythmbox'
 (defvar helm-rhythmbox-library)