branch: master commit 8b4c9395a4d41c5c530be875c43b2fb0a5035eed Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
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)