1)
Is it possible to force Projectile to not attach special means to .git / .svn etc i.e not consider it as a project or anything special ? . For example supose I have a base folder called work - > I might type usbkermod --- To open work/usb/kernel/module file - Its possible that usb folder is a git repo , and kernel too is another repo - but they are not another projects - just a component in my project - which happens to be version controlled . Looks like projectile treats it as another project and stops its fuzzy search with the usb directory in the above example !
I tried setting (setq projectile-require-project-root nil) but thats my requirement I think .
Summary : Projectile C-c p f in a Folder should assume the root as that Folder and nothing else .
I like the way Projectile behaves but the way it assumes that .git or .svn is something significant i.e Projects on its own . My work usually involves taking 50 repos and integrating it to a large product .
2) Besides would it be possible for us to see the Index Count realtime in Projectile ? Sometimes the indexing freezes so its good if we can have a real time feedback on the index scan status ?
Edit1 : (setq projectile-indexing-method 'native) seems to work as expected . But incredibly slow :( . Suppose I have a folder "work" with just 3 folder "usb" , "mouse" , "keyboard" ( each of them being git repo's ) , if I set projective-require-project-root nil and projectile-project-root-files as "" , then it finds everything in all sub directories like I expect it . If that worked in default mode would have been my exact requirement . Coming from vim background I like ctrl-p really well and this feature might make projectile pretty much similar to ctrlp in all aspects
I too have similar problem. For example, in my .emacs.d which is under VC as my config I have directory dev/ where I keep projects I develop or contribute to---they are all under git. When I'm somewhere in the top directory (above dev/) and I invoke C-c -p f it skips all the content in these subrepos: I find that undesirable. However, when I descend down into one of these repos, I find it correct that it would only search in this "project".
The solution is to only look up in the dictionary tree for the root, and then consider everything inside as part of "current" project. It could automagically ignore .git, .svn and such directories, but not the content itself.
Well, in the meantime I've fixed it by using this as a commant to retrieve files in project:
(concat
"find . -not \\( \\( "
(mapconcat (lambda (x)
(concat "-path \"*/" x "/*\"")) projectile-globally-ignored-directories " -or ")
" -or "
(mapconcat (lambda (x)
(concat "-path \"" x "\""))
(let ((project-root (projectile-project-root)))
(--map (concat "./" (file-relative-name it project-root)) (projectile-project-ignored-directories))) " -or ")
" \\) -prune \\)"
" -not "
(mapconcat (lambda (x)
(concat "-path \"*/" x "\"")) projectile-globally-ignored-directories " -not ")
" -type f -print0")
that is, I've replaced definition of projectile-get-ext-command to always return this monster^^
Well, here's a little fix in case there are no ignored directories... I'm also thinking about pulling in the .gitignore info somehow
(concat
"find . -not \\( \\( "
(mapconcat (lambda (x)
(concat "-path \"*/" x "/*\"")) projectile-globally-ignored-directories " -or ")
(let ((proj-ig-dirs (projectile-project-ignored-directories)))
(if (not proj-ig-dirs) ""
(concat
" -or "
(mapconcat (lambda (x)
(concat "-path \"" x "\""))
(let ((project-root (projectile-project-root)))
(--map (concat "./" (file-relative-name it project-root)) proj-ig-dirs)) " -or "))))
" \\) -prune \\)"
" -not "
(mapconcat (lambda (x)
(concat "-path \"*/" x "\"")) projectile-globally-ignored-directories " -not ")
" -type f -print0")
I also had to patch projectile-project-root
(defun projectile-project-root ()
"Retrieves the root directory of a project if available.
The current directory is assumed to be the project's root otherwise."
(let ((project-root
(or (->> projectile-project-root-files
(--map (locate-dominating-file (file-truename default-directory) it))
(-remove #'null)
(--max-by (> (s-count-matches "/" it) (s-count-matches "/" other))) ;;; return the closest "parent dir" for this (possible) subproject
(projectile-file-truename))
(if projectile-require-project-root
(error "You're not in a project")
default-directory))))
project-root))
+1
Using @Fuco1's patch as interim solution right now for git submodules inside of larger project.
It seems to me a better solution would be to prioritize finding project root containing a .projectile file over a root containing any of the other (vcs) projectile-project-root-files - even if the .projectile file is further up in the directory hierarchy. I plan on implementing this change but won't have time for a few days. Thoughts on this approach are very much appreciated.
@ChrisDunder See #299.
Most helpful comment
It seems to me a better solution would be to prioritize finding project root containing a .projectile file over a root containing any of the other (vcs) projectile-project-root-files - even if the .projectile file is further up in the directory hierarchy. I plan on implementing this change but won't have time for a few days. Thoughts on this approach are very much appreciated.