diff options
author | David Morgan <djm_uk@protonmail.com> | 2021-09-06 13:41:50 +0100 |
---|---|---|
committer | David Morgan <djm_uk@protonmail.com> | 2021-09-06 13:41:50 +0100 |
commit | a7055e06482c87468382b97c9a1000f251887667 (patch) | |
tree | 323c98fa70dbced596e7feedc8df5212daabb254 /.emacs.d | |
parent | 113355a67115ae42da9d6cc5d2c3957be31bb7d0 (diff) | |
download | dotfiles-a7055e06482c87468382b97c9a1000f251887667.tar.gz |
Only use fd with consult-project-buffer
Diffstat (limited to '.emacs.d')
-rw-r--r-- | .emacs.d/lisp/init-minibuffer.el | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/.emacs.d/lisp/init-minibuffer.el b/.emacs.d/lisp/init-minibuffer.el index 02e95c1..148986e 100644 --- a/.emacs.d/lisp/init-minibuffer.el +++ b/.emacs.d/lisp/init-minibuffer.el @@ -295,30 +295,27 @@ (plist-put (copy-sequence consult--source-project-file) :narrow '(?x "Project Files"))) (add-to-list 'consult-buffer-sources 'consult--source-perspective-files t) - ;; Use fd that that we aren't just getting recentf, but also respect .gitignore - (setq consult--source-project-file - (plist-put consult--source-project-file - :items '(lambda () - (when-let (root (consult--project-root)) - (let ((len (length root)) - (inv-root (propertize root 'invisible t))) - (mapcar (lambda (x) - (concat inv-root (substring x len))) - (split-string - (shell-command-to-string - (format "fd --color never -t f -0 . %s" root)) - "\0" t))))))) - ;; Versions of consult--source-project-buffer and consult--source-project-file for use by consult-project-buffer ;; They allow narrowing with b and f (instead of p) + ;; The file version uses fd to find items, so that all files (rather than using recentf) are listed, respecing .gitignore (defvar consult--project-source-project-buffer (plist-put (plist-put (copy-sequence consult--source-project-buffer) :hidden nil) :narrow '(?b . "Project Buffer"))) (defvar consult--project-source-project-file - (plist-put (plist-put (copy-sequence consult--source-project-file) - :hidden nil) - :narrow '(?f . "Project File"))) + (plist-put (plist-put (plist-put (copy-sequence consult--source-project-file) + :hidden nil) + :narrow '(?f . "Project File")) + :items '(lambda () + (when-let (root (consult--project-root)) + (let ((len (length root)) + (inv-root (propertize root 'invisible t))) + (mapcar (lambda (x) + (concat inv-root (substring x len))) + (split-string + (shell-command-to-string + (format "fd --color never -t f -0 . %s" root)) + "\0" t))))))) (defun consult-project-buffer () (interactive) |