From 7f7ede201b1eb1a9ac7811b716bf39a5adae9896 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 28 Apr 2022 15:49:22 -0500 Subject: Dim .gitignore files (mostly) in dired --- init.el | 5 +++-- lisp/+dired.el | 10 ++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/init.el b/init.el index c2e0460..2137179 100644 --- a/init.el +++ b/init.el @@ -269,7 +269,7 @@ compilation-scroll-output t)) (setup dired - (:also-load dired-x +dired) + (:require dired-x +dired) (:straight dired+) (:option dired-recursive-copies 'always dired-recursive-deletes 'always @@ -293,7 +293,8 @@ "j" #'+dired-goto-file) (:hook #'dired-hide-details-mode #'hl-line-mode - #'lin-mode) + #'lin-mode + #'+dired-dim-git-ignores) (:+key "C-x C-j" #'dired-jump) (dolist (refresh-after-func '(dired-do-flagged-delete)) (advice-add refresh-after-func :after #'revert-buffer)) diff --git a/lisp/+dired.el b/lisp/+dired.el index 131d326..9a2e01a 100644 --- a/lisp/+dired.el +++ b/lisp/+dired.el @@ -15,5 +15,15 @@ (push-mark))) (dired-goto-file file)) +;;; [[https://www.reddit.com/r/emacs/comments/u2lf9t/weekly_tips_tricks_c_thread/i4n9aoa/?context=3][Dim files in .gitignore]] + +(defun +dired-dim-git-ignores () + "Dim out .gitignore contents" + (require 'vc) + (when-let ((ignores (vc-default-ignore-completion-table 'git ".gitignore")) + (exts (make-local-variable 'completion-ignored-extensions))) + (dolist (item ignores) + (add-to-list exts item)))) + (provide '+dired) ;;; +dired.el ends here -- cgit 1.4.1-21-gabe81