Projectile might not be loaded. (require 'projectile) should work fine.
Some projectile functions, listed by M-x, are just prepared to be autoloaded.
EDIT: Thanks, @Basil
The answer above is not wrong. But in your init.el, writing (require 'projectile) is not recommended, because projectile can be loaded on your first time to use one of the projectile ...
Did you save the .dir-locals.el file? Are you loading these files via TRAMP? By default, Emacs doesn't look for the .dir-locals.el file when loading files via TRAMP, as it might add significant delays. If this is the problem, you can set enable-remote-dir-locals to t to opt in.
I've figured out why this is happening to your environment after reading your comments below.
There are two projectile-ripgrep (package projectile & package projectile-ripgrep). Whichever is loaded second in order is being used, hence the different behavior on your machine.
(I don't have enough reputation to add a comment.)
According to the docstring of projectile-test-command, this function first check projectile-test-cmd-map for the last command. It is likely you inadvertently invoked an empty "" command in that emacs session, and that empty command was stored inside the hash-table. The problem will probably disappear when you restart emacs or invoke (clrhash ...
What I would want is a function or a package that could display all opened projectile projects with ivy or helm and let me choose a candidate. When the candidate would be selected, the last buffer opened in that project would be opened. It would be basically a counsel-switch-buffer but with projects. If possible the last visited project would display first.
Check if the variable projectile-indexing-method is set to alien. If that's the case Projectile will ignore ignores/unignores/sorting provided in Projectile config:
The alien indexing method optimizes to the limit the speed of the
hybrid indexing method. This means that Projectile will not do any
processing of the files returned by the external commands ...
A very basic code example to achieve fuzzy search using a single grep would be:
(defun custom-counsel-function (str)
(let ((str (split-string str)))
(format "rg --max-columns 240 --with-filename --no-heading --line-number --color never '%s' | grep %s"
s-p p (where s-p represents whatever prefix key you have chosen) will allow you to choose a different project. It then prompts you to open a file from that project; you can just open whatever file is first in the list for speed. Then do the search.
C-u M-x project-find-regexp.
See its documentation,
project-find-regexp is an interactive Lisp closure in ‘project.el.gz’.
Probably introduced at or before Emacs version 25.1.
Find all matches for REGEXP in the current project’s roots.
With C-u prefix, you can specify the directory
to search in, and the file name pattern to ...
The help for projectile-grep mentions the setting projectile-grep-default-files. I believe that you could use directory–local variables to set this to the correct value on a per–project basis, but I’ve not tried it myself.
Personally I use Ripgrep instead of grep. Ripgrep honors the .gitignore files that my projects all have, so it already ignores compiled ...
See a detailed solution in my blog article:
If you like to quickly see how to exclude files/folder from your projectile-find-file, a short version here: https://emacs.stackexchange.com/a/63744/9262
A new solution with no speed compromise of projectile
Since projetile-indexing-method is default set to alien, both
projectile-globally-ignored-files will not be used. However, choosing
native indexing method compromises speed performance considerably,
especially for large projects.
Suppose we prefer alien for best ...