branch: master
commit 9fa4d7cff04ed7fcf1768043cb722a2830c87959
Author: Basil L. Contovounesios <[email protected]>
Commit: Basil L. Contovounesios <[email protected]>
ivy.el: Add buffer->file completion switch action
Based on the idea of Nathan Moreau <[email protected]>.
Re #1295
---
ivy.el | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/ivy.el b/ivy.el
index d2fa15c..fd2d130 100644
--- a/ivy.el
+++ b/ivy.el
@@ -3557,14 +3557,24 @@ BUFFER may be a string or nil."
(ivy-set-actions
'ivy-switch-buffer
- '(("k"
- (lambda (x)
- (kill-buffer x)
- (ivy--reset-state ivy-last))
- "kill")
+ `(("f"
+ ,(lambda (x)
+ (let* ((b (get-buffer x))
+ (default-directory
+ (or (and b (buffer-local-value 'default-directory b))
+ default-directory)))
+ (call-interactively (if (fboundp 'counsel-find-file)
+ #'counsel-find-file
+ #'find-file))))
+ "find file")
("j"
ivy--switch-buffer-other-window-action
"other window")
+ ("k"
+ ,(lambda (x)
+ (kill-buffer x)
+ (ivy--reset-state ivy-last))
+ "kill")
("r"
ivy--rename-buffer-action
"rename")))