This is a neovim plugin which automatically :set path=...
in the project, make it possible to use :find <search>
without relying on fuzzy finder plugins.
See :h :find
for more information.
- It will use
fd
, if exists. - If not, then it will use
git ls-files
if it is currently inside a git project. - Otherwise, it will
set path=**
as fallback.
Did you know that vim has a built-in file finder? Here's me browsing files in the neovim project, using nothing but vim's :find
cmd.
vim-file-finder.mov
This approach is suitable for those looking for a way to fuzzy find files in neovim but don't want to rely on external fuzzy finder.
-- lazy.nvim
{
"pirey/autopath",
opts = { set_keymap = true }
}
-- setup manually
require('autopath').setup({
set_keymap = true
})
Type in :find
followed by partial filename or pattern, then press <tab>
to find any matches.
For example:
:find main<tab>
fuzzy match using pattern
:find long*filename<tab>
NOTE: this does not support real fuzzy matching, i.e. if the filename is "my_long_filename" we cannot type
:find myfile<tab>
but we can type:find my*file<tab>
and it will match
By default this plugin will set a keymap, <leader>f
as a shortcut to invoke :find
.
We can skip the keymap creation by passing { set_keymap = false }
when calling setup()
.