completion/ivy: dim non-project entries in counsel-recentf
Added +ivy-recentf-transformer to counsel-recentf. Entries that aren't in the same project as the buffer recentf was opened from will be slightly dimmed.
This commit is contained in:
parent
1f52669684
commit
4b4447d31e
2 changed files with 11 additions and 1 deletions
|
@ -24,6 +24,15 @@
|
||||||
;; Library
|
;; 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
|
;;;###autoload
|
||||||
(defun +ivy-buffer-transformer (str)
|
(defun +ivy-buffer-transformer (str)
|
||||||
"Dim special buffers, buffers whose file aren't in the current buffer, and
|
"Dim special buffers, buffers whose file aren't in the current buffer, and
|
||||||
|
|
|
@ -86,7 +86,8 @@ immediately runs it on the current candidate (ending the ivy session)."
|
||||||
(def-package! counsel
|
(def-package! counsel
|
||||||
:requires ivy
|
:requires ivy
|
||||||
:config
|
: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)
|
(require 'counsel-projectile)
|
||||||
(setq counsel-find-file-ignore-regexp "\\(?:^[#.]\\)\\|\\(?:[#~]$\\)\\|\\(?:^Icon?\\)")
|
(setq counsel-find-file-ignore-regexp "\\(?:^[#.]\\)\\|\\(?:[#~]$\\)\\|\\(?:^Icon?\\)")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue