feat: add no_ignore option to find_files (#1010)
Allow find_files to find files ignored by .gitignore and other ignore files. This is supported by fd, rg, and fdfind.
This commit is contained in:
@@ -143,6 +143,7 @@ end
|
||||
files.find_files = function(opts)
|
||||
local find_command = opts.find_command
|
||||
local hidden = opts.hidden
|
||||
local no_ignore = opts.no_ignore
|
||||
local follow = opts.follow
|
||||
local search_dirs = opts.search_dirs
|
||||
|
||||
@@ -158,6 +159,9 @@ files.find_files = function(opts)
|
||||
if hidden then
|
||||
table.insert(find_command, "--hidden")
|
||||
end
|
||||
if no_ignore then
|
||||
table.insert(find_command, "--no-ignore")
|
||||
end
|
||||
if follow then
|
||||
table.insert(find_command, "-L")
|
||||
end
|
||||
@@ -172,6 +176,9 @@ files.find_files = function(opts)
|
||||
if hidden then
|
||||
table.insert(find_command, "--hidden")
|
||||
end
|
||||
if no_ignore then
|
||||
table.insert(find_command, "--no-ignore")
|
||||
end
|
||||
if follow then
|
||||
table.insert(find_command, "-L")
|
||||
end
|
||||
@@ -186,6 +193,9 @@ files.find_files = function(opts)
|
||||
if hidden then
|
||||
table.insert(find_command, "--hidden")
|
||||
end
|
||||
if no_ignore then
|
||||
table.insert(find_command, "--no-ignore")
|
||||
end
|
||||
if follow then
|
||||
table.insert(find_command, "-L")
|
||||
end
|
||||
@@ -200,6 +210,9 @@ files.find_files = function(opts)
|
||||
table.insert(find_command, { "-not", "-path", "*/.*" })
|
||||
find_command = flatten(find_command)
|
||||
end
|
||||
if no_ignore ~= nil then
|
||||
log.warn "The `no_ignore` key is not available for the `find` command in `find_files`."
|
||||
end
|
||||
if follow then
|
||||
table.insert(find_command, "-L")
|
||||
end
|
||||
@@ -214,6 +227,9 @@ files.find_files = function(opts)
|
||||
if hidden ~= nil then
|
||||
log.warn "The `hidden` key is not available for the Windows `where` command in `find_files`."
|
||||
end
|
||||
if no_ignore ~= nil then
|
||||
log.warn "The `no_ignore` key is not available for the Windows `where` command in `find_files`."
|
||||
end
|
||||
if follow ~= nil then
|
||||
log.warn "The `follow` key is not available for the Windows `where` command in `find_files`."
|
||||
end
|
||||
|
||||
@@ -84,6 +84,7 @@ builtin.grep_string = require("telescope.builtin.files").grep_string
|
||||
---@field find_command table: command line arguments for `find_files` to use for the search, overrides default config
|
||||
---@field follow boolean: if true, follows symlinks (i.e. uses `-L` flag for the `find` command)
|
||||
---@field hidden boolean: determines whether to show hidden files or not (default is false)
|
||||
---@field no_ignore boolean: show files ignored by .gitignore, .ignore, etc. (default is false)
|
||||
---@field search_dirs table: directory/directories to search in
|
||||
builtin.find_files = require("telescope.builtin.files").find_files
|
||||
|
||||
|
||||
Reference in New Issue
Block a user