feat: include hidden files when scanning directories (#2700)
This commit is contained in:
@@ -896,21 +896,43 @@ function M.scan_directory(options)
|
|||||||
local cmd_supports_max_depth = true
|
local cmd_supports_max_depth = true
|
||||||
local cmd = (function()
|
local cmd = (function()
|
||||||
if vim.fn.executable("rg") == 1 then
|
if vim.fn.executable("rg") == 1 then
|
||||||
local cmd = { "rg", "--files", "--color", "never", "--no-require-git", "--no-ignore-parent" }
|
local cmd = {
|
||||||
|
"rg",
|
||||||
|
"--files",
|
||||||
|
"--color",
|
||||||
|
"never",
|
||||||
|
"--no-require-git",
|
||||||
|
"--no-ignore-parent",
|
||||||
|
"--hidden",
|
||||||
|
"--glob",
|
||||||
|
"!.git/",
|
||||||
|
}
|
||||||
|
|
||||||
if options.max_depth ~= nil then vim.list_extend(cmd, { "--max-depth", options.max_depth }) end
|
if options.max_depth ~= nil then vim.list_extend(cmd, { "--max-depth", options.max_depth }) end
|
||||||
table.insert(cmd, options.directory)
|
table.insert(cmd, options.directory)
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
end
|
end
|
||||||
if vim.fn.executable("fd") == 1 then
|
|
||||||
local cmd = { "fd", "--type", "f", "--color", "never", "--no-require-git" }
|
-- fd is called 'fdfind' on Debian/Ubuntu due to naming conflicts
|
||||||
if options.max_depth ~= nil then vim.list_extend(cmd, { "--max-depth", options.max_depth }) end
|
local fd_executable = vim.fn.executable("fd") == 1 and "fd"
|
||||||
vim.list_extend(cmd, { "--base-directory", options.directory })
|
or (vim.fn.executable("fdfind") == 1 and "fdfind" or nil)
|
||||||
return cmd
|
if fd_executable then
|
||||||
end
|
local cmd = {
|
||||||
if vim.fn.executable("fdfind") == 1 then
|
fd_executable,
|
||||||
local cmd = { "fdfind", "--type", "f", "--color", "never", "--no-require-git" }
|
"--type",
|
||||||
|
"f",
|
||||||
|
"--color",
|
||||||
|
"never",
|
||||||
|
"--no-require-git",
|
||||||
|
"--hidden",
|
||||||
|
"--exclude",
|
||||||
|
".git",
|
||||||
|
}
|
||||||
|
|
||||||
if options.max_depth ~= nil then vim.list_extend(cmd, { "--max-depth", options.max_depth }) end
|
if options.max_depth ~= nil then vim.list_extend(cmd, { "--max-depth", options.max_depth }) end
|
||||||
vim.list_extend(cmd, { "--base-directory", options.directory })
|
vim.list_extend(cmd, { "--base-directory", options.directory })
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
end
|
end
|
||||||
end)()
|
end)()
|
||||||
|
|||||||
Reference in New Issue
Block a user