branch: master
commit b06daca74bd7b09116b9d4f3bd9a93b2c11a5272
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
ivy.el (ivy-virtual-abbreviate): New defcustom
* ivy.el (ivy--virtual-buffers): Update.
Fixes #255
---
ivy.el | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/ivy.el b/ivy.el
index 7228acb..02b6c73 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1786,6 +1786,14 @@ CANDS is a list of strings."
(defface ivy-virtual '((t :inherit font-lock-builtin-face))
"Face used by Ivy for matching virtual buffer names.")
+(defcustom ivy-virtual-abbreviate 'name
+ "The mode of abbreviation for virtual buffer names."
+ :type '(choice
+ (const :tag "Only name" 'name)
+ (const :tag "Full path" 'full)
+ ;; eventually, uniquify
+ ))
+
(defun ivy--virtual-buffers ()
"Adapted from `ido-add-virtual-buffers-to-list'."
(unless recentf-mode
@@ -1799,7 +1807,10 @@ CANDS is a list of strings."
(delq nil (mapcar (lambda (bookmark)
(cdr (assoc 'filename
bookmark)))
bookmarks)))))
- (setq name (file-name-nondirectory head))
+ (setq name
+ (if (eq ivy-virtual-abbreviate 'name)
+ (file-name-nondirectory head)
+ (expand-file-name head)))
(when (equal name "")
(setq name (file-name-nondirectory (directory-file-name head))))
(when (equal name "")