fix(telescope): dont use git_files when .ignore or .rgignore file is present

This commit is contained in:
Folke Lemaitre committed 2024-03-07 11:43:22 +01:00
1 parent 66bf7525e3
commit e7a58d9484
1 file changed
+5 -1
+5 -1
View File
@@ -24,7 +24,11 @@ function M.telescope(builtin, opts)
opts = params.opts
opts = vim.tbl_deep_extend("force", { cwd = Util.root() }, opts or {}) --[[@as lazyvim.util.telescope.opts]]
if builtin == "files" then
if vim.loop.fs_stat((opts.cwd or vim.loop.cwd()) .. "/.git") then
if
vim.loop.fs_stat((opts.cwd or vim.loop.cwd()) .. "/.git")
and not vim.loop.fs_stat((opts.cwd or vim.loop.cwd()) .. "/.ignore")
and not vim.loop.fs_stat((opts.cwd or vim.loop.cwd()) .. "/.rgignore")
then
opts.show_untracked = true
builtin = "git_files"
else