branch: master
commit 525a19d139b62464ac0872f89d498252446799a0
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
Propertize directories with ivy-subdir face
* ivy.el (ivy-subdir): New defface.
(ivy-completions): Update.
---
ivy.el | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/ivy.el b/ivy.el
index 3d40b64..784ef0b 100644
--- a/ivy.el
+++ b/ivy.el
@@ -46,6 +46,10 @@
'((t (:inherit highlight)))
"Face used by Ivy for highlighting first match.")
+(defface ivy-subdir
+ '((t (:weight bold)))
+ "Face used by Ivy for highlighting subdirs in the alternatives.")
+
(defcustom ivy-height 10
"Number of lines for the minibuffer window."
:type 'integer)
@@ -606,6 +610,12 @@ CANDIDATES is a list of strings."
(end (min (+ start (1- ivy-height)) ivy--length))
(cands (cl-subseq cands start end))
(index (min ivy--index half-height (1- (length cands)))))
+ (when ivy--directory
+ (setq cands (mapcar (lambda (x)
+ (if (string-match-p "/$" x)
+ (propertize x 'face 'ivy-subdir)
+ x))
+ cands)))
(setq ivy--current (copy-sequence (nth index cands)))
(setf (nth index cands)
(ivy--add-face ivy--current 'ivy-current-match))