fix(pick): get rid of "auto" picker and set better defaults for telescope find_files (#4024)

## Description

Changes telescope's `find_files` options to match `fzf-lua` that matches
what `git_files` does including untracked files.

## Related Issue(s)

Fixes #3974

## Screenshots

<!-- Add screenshots of the changes if applicable. -->

## Checklist

- [x] I've read the
[CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md)
guidelines.
This commit is contained in:
Folke Lemaitre 2024-07-14 07:52:00 +02:00 committed by GitHub
parent 065d72320d
commit 337e9ddc00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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