I organize my ~/Code folder by language. So it's directory structure might look like...
โโโ browser-extensions
โย ย โโโ My Cool Extension
โย ย โโโ My Other Cool Extension
โโโ Jekyll
โย ย โโโ Some Website
โโโ python
โย ย โโโ Some Python Project
I use this to set my project search path.
(setq projectile-project-search-path '("~/Code"))
Instead of adding each sub-folder to my projectile search path (I have quite a few languages/categories in there), I would love to be able to run projectile-discover-projects-in-search-path and have it go recursively.
Any thoughts?
For my unique situation, I came up with a pretty simple solution.
(setq projectile-project-search-path (cddr (directory-files "~/Code" t)))
(The cddr bit removes the first two items from the returned list which are . and .. directories.)
Could also use the function directory-files-recursively which will catch any projects nested even deeper. :)
thank you for the workaround.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!
I do this FWIW:
;;;###autoload
(defun mb-cmd-projectile-index-projects ()
"Index my project directories."
(interactive)
(mapc #'projectile-add-known-project
(mb-f-find-git-projects "~/" 5))
(projectile-cleanup-known-projects))
(defun mb-f-find-git-projects (dir &optional depth)
"Find all git projects under DIR.
Optionally only search as deep as DEPTH."
(let* ((depth-flag (if depth (format "-maxdepth %d" depth) ""))
(cmd (format "find %s %s -name '.git' -type d" dir depth-flag))
(result (split-string (shell-command-to-string cmd))))
(mapcar (lambda (s) (substring s 0 -4)) result)))
;; This is from memory, I have another construct for simplifying keybindings.
(define-key 'projectile-command-map (kbd "i") #'mb-cmd-projectile-index-projects)
Most helpful comment
thank you for the workaround.