diff --git a/modules/completion/ivy/autoload/ivy.el b/modules/completion/ivy/autoload/ivy.el index 01b59253b..5d666cdac 100644 --- a/modules/completion/ivy/autoload/ivy.el +++ b/modules/completion/ivy/autoload/ivy.el @@ -208,6 +208,24 @@ search current file. See `+ivy-task-tags' to customize what this searches for." ;; File searching ;; +;;;###autoload +(defun +ivy/projectile-find-file () + "A more sensible `projectile-find-file', which will revert to +`counsel-find-file' if invoked from $HOME (usually not what you want), or +`counsel-file-jump' if invoked from a non-project. + +Both are much faster than letting `projectile-find-file' index massive file +trees." + (interactive) + (call-interactively + (cond ((or (file-equal-p default-directory "~") + (when-let* ((proot (doom-project-root 'nocache))) + (file-equal-p proot "~"))) + #'counsel-find-file) + ((doom-project-p 'nocache) + #'projectile-find-file) + (#'counsel-file-jump)))) + ;;;###autoload (cl-defun +ivy-file-search (engine &key query in all-files (recursive t)) "Conduct a file search using ENGINE, which can be any of: rg, ag, pt, and diff --git a/modules/completion/ivy/config.el b/modules/completion/ivy/config.el index 94a275a78..aedfd1bd3 100644 --- a/modules/completion/ivy/config.el +++ b/modules/completion/ivy/config.el @@ -159,7 +159,7 @@ immediately runs it on the current candidate (ending the ivy session)." counsel-projectile-grep counsel-projectile-ag counsel-projectile-switch-project) :init (define-key! 'global - [remap projectile-find-file] #'counsel-projectile-find-file + [remap projectile-find-file] #'+ivy/projectile-find-file [remap projectile-find-dir] #'counsel-projectile-find-dir [remap projectile-switch-to-buffer] #'counsel-projectile-switch-to-buffer [remap projectile-grep] #'counsel-projectile-grep