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

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

[elpa] master aaad354 088/348: counsel.el (counsel-find-file): Switch di


From: Oleh Krehel
Subject: [elpa] master aaad354 088/348: counsel.el (counsel-find-file): Switch directory with "M-o b"
Date: Sat, 8 Apr 2017 11:03:34 -0400 (EDT)

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

    counsel.el (counsel-find-file): Switch directory with "M-o b"
    
    Fixes #531
---
 counsel.el | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/counsel.el b/counsel.el
index 0e91741..38c1031 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1207,9 +1207,21 @@ done") "\n" t)))
 
 (add-to-list 'ivy-ffap-url-functions 'counsel-github-url-p)
 (add-to-list 'ivy-ffap-url-functions 'counsel-emacs-url-p)
+(defun counsel-find-file-cd-bookmark-action (_)
+  "Reset `counsel-find-file' from selected directory."
+  (ivy-read "cd: "
+            (progn
+              (ivy--virtual-buffers)
+              (delete-dups
+               (mapcar (lambda (x) (file-name-directory (cdr x)))
+                       ivy--virtual-buffers)))
+            :action (lambda (x)
+                      (let ((default-directory (file-name-directory x)))
+                        (counsel-find-file)))))
 (ivy-set-actions
  'counsel-find-file
- '(("j" find-file-other-window "other window")))
+ '(("j" find-file-other-window "other window")
+   ("b" counsel-find-file-cd-bookmark-action "cd bookmark")))
 
 (defcustom counsel-find-file-at-point nil
   "When non-nil, add file-at-point to the list of candidates."



reply via email to

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