feat: get rid of "auto" picker and set better defaults for telescope find_files. Fixes #3974

This commit is contained in:
Folke Lemaitre 2024-07-13 23:34:53 +02:00
parent 431ceaf329
commit 1bf5f15b26
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
3 changed files with 13 additions and 22 deletions

View file

@ -57,7 +57,7 @@ function M.open(command, opts)
return LazyVim.error("LazyVim.pick: picker not set")
end
command = command or "auto"
command = command ~= "auto" and command or "files"
opts = opts or {}
opts = vim.deepcopy(opts)
@ -71,21 +71,6 @@ function M.open(command, opts)
opts.cwd = LazyVim.root({ buf = opts.buf })
end
local cwd = opts.cwd or vim.uv.cwd()
if command == "auto" then
command = "files"
if
vim.uv.fs_stat(cwd .. "/.git")
and not vim.uv.fs_stat(cwd .. "/.ignore")
and not vim.uv.fs_stat(cwd .. "/.rgignore")
then
command = "git_files"
if opts.show_untracked == nil then
opts.show_untracked = true
opts.recurse_submodules = false
end
end
end
command = M.picker.commands[command] or command
M.picker.open(command, opts)
end