diff --git a/modules/completion/ivy/autoload/ivy.el b/modules/completion/ivy/autoload/ivy.el index a612a426d..0468be74f 100644 --- a/modules/completion/ivy/autoload/ivy.el +++ b/modules/completion/ivy/autoload/ivy.el @@ -24,6 +24,15 @@ ;; Library ;; +;;;###autoload +(defun +ivy-recentf-transformer (str) + "Dim recentf entries that are not in the current project of the buffer you +started `counsel-recentf' from. Also uses `abbreviate-file-name'." + (let ((str (abbreviate-file-name str))) + (if (file-in-directory-p str (doom-project-root)) + str + (propertize str 'face 'ivy-virtual)))) + ;;;###autoload (defun +ivy-buffer-transformer (str) "Dim special buffers, buffers whose file aren't in the current buffer, and diff --git a/modules/completion/ivy/config.el b/modules/completion/ivy/config.el index a9bc09ee9..c6b99de8e 100644 --- a/modules/completion/ivy/config.el +++ b/modules/completion/ivy/config.el @@ -86,7 +86,8 @@ immediately runs it on the current candidate (ending the ivy session)." (def-package! counsel :requires ivy :config - (ivy-set-display-transformer #'counsel-recentf #'abbreviate-file-name) + ;; Dim recentf entries that are not in the current project. + (ivy-set-display-transformer 'counsel-recentf '+ivy-recentf-transformer) (require 'counsel-projectile) (setq counsel-find-file-ignore-regexp "\\(?:^[#.]\\)\\|\\(?:[#~]$\\)\\|\\(?:^Icon?\\)")