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

This commit is contained in:
Folke Lemaitre 2024-02-27 08:35:41 +01:00
parent 66bf7525e3
commit e7a58d9484
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

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