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

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

[elpa] master 8b4c939 100/399: counsel.el (counsel-cd): Add


From: Oleh Krehel
Subject: [elpa] master 8b4c939 100/399: counsel.el (counsel-cd): Add
Date: Sat, 20 Jul 2019 14:56:57 -0400 (EDT)

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

    counsel.el (counsel-cd): Add
---
 counsel.el | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/counsel.el b/counsel.el
index 106ca93..f5bd477 100644
--- a/counsel.el
+++ b/counsel.el
@@ -2562,6 +2562,7 @@ It applies no filtering to ivy--all-candidates."
     (define-key map (kbd "C-l") 'ivy-call-and-recenter)
     (define-key map (kbd "M-q") 'counsel-git-grep-query-replace)
     (define-key map (kbd "C-'") 'swiper-avy)
+    (define-key map (kbd "C-x C-d") 'counsel-cd)
     map))
 
 (defcustom counsel-ag-base-command
@@ -2672,6 +2673,15 @@ CALLER is passed to `ivy-read'."
                         (swiper--cleanup))
               :caller (or caller 'counsel-ag))))
 
+(defun counsel-cd ()
+  "Change the directory for the currently running Ivy command."
+  (interactive)
+  (let ((input ivy-text)
+        (new-dir (read-directory-name "cd: ")))
+    (ivy-quit-and-run
+      (let ((default-directory new-dir))
+        (funcall (ivy-state-caller ivy-last) input)))))
+
 (cl-pushnew 'counsel-ag ivy-highlight-grep-commands)
 
 (defun counsel-grep-like-occur (cmd-template)



reply via email to

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