Function: projectile-find-file-dwim
projectile-find-file-dwim is an autoloaded, interactive and
byte-compiled function defined in projectile.el.
Signature
(projectile-find-file-dwim &optional INVALIDATE-CACHE)
Documentation
Jump to a project's files using completion based on context.
With a prefix arg INVALIDATE-CACHE invalidates the cache first.
If point is on a filename, Projectile first tries to search for that file in project:
- If it finds just a file, it switches to that file instantly. This works
even if the filename is incomplete, but there's only a single file in the
current project that matches the filename at point. For example, if
there's only a single file named "projectile/projectile.el" but the
current filename is "projectile/proj" (incomplete),
projectile-find-file-dwim still switches to "projectile/projectile.el"
immediately because this is the only filename that matches.
- If it finds a list of files, the list is displayed for selecting. A list
of files is displayed when a filename appears more than one in the project
or the filename at point is a prefix of more than two files in a project.
For example, if projectile-find-file-dwim is executed on a filepath like
"projectile/", it lists the content of that directory. If it is executed
on a partial filename like "projectile/a", a list of files with character
"a" in that directory is presented.
- If it finds nothing, display a list of all files in project for selecting.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/projectile-20260310.858/projectile.el
;;;###autoload
(defun projectile-find-file-dwim (&optional invalidate-cache)
"Jump to a project's files using completion based on context.
With a prefix arg INVALIDATE-CACHE invalidates the cache first.
If point is on a filename, Projectile first tries to search for that
file in project:
- If it finds just a file, it switches to that file instantly. This works
even if the filename is incomplete, but there's only a single file in the
current project that matches the filename at point. For example, if
there's only a single file named \"projectile/projectile.el\" but the
current filename is \"projectile/proj\" (incomplete),
`projectile-find-file-dwim' still switches to \"projectile/projectile.el\"
immediately because this is the only filename that matches.
- If it finds a list of files, the list is displayed for selecting. A list
of files is displayed when a filename appears more than one in the project
or the filename at point is a prefix of more than two files in a project.
For example, if `projectile-find-file-dwim' is executed on a filepath like
\"projectile/\", it lists the content of that directory. If it is executed
on a partial filename like \"projectile/a\", a list of files with character
\"a\" in that directory is presented.
- If it finds nothing, display a list of all files in project for selecting."
(interactive "P")
(projectile--find-file-dwim invalidate-cache))