Compare commits

...

1 Commits

3 changed files with 13 additions and 22 deletions

View File

@ -211,12 +211,12 @@ return {
},
{ "<leader>/", LazyVim.pick("live_grep"), desc = "Grep (Root Dir)" },
{ "<leader>:", "<cmd>FzfLua command_history<cr>", desc = "Command History" },
{ "<leader><space>", LazyVim.pick("auto"), desc = "Find Files (Root Dir)" },
{ "<leader><space>", LazyVim.pick("files"), desc = "Find Files (Root Dir)" },
-- find
{ "<leader>fb", "<cmd>FzfLua buffers sort_mru=true sort_lastused=true<cr>", desc = "Buffers" },
{ "<leader>fc", LazyVim.pick.config_files(), desc = "Find Config File" },
{ "<leader>ff", LazyVim.pick("auto"), desc = "Find Files (Root Dir)" },
{ "<leader>fF", LazyVim.pick("auto", { root = false }), desc = "Find Files (cwd)" },
{ "<leader>ff", LazyVim.pick("files"), desc = "Find Files (Root Dir)" },
{ "<leader>fF", LazyVim.pick("files", { root = false }), desc = "Find Files (cwd)" },
{ "<leader>fg", "<cmd>FzfLua git_files<cr>", desc = "Find Files (git-files)" },
{ "<leader>fr", "<cmd>FzfLua oldfiles<cr>", desc = "Recent" },
{ "<leader>fR", LazyVim.pick("oldfiles", { cwd = vim.uv.cwd() }), desc = "Recent (cwd)" },

View File

@ -92,12 +92,12 @@ return {
},
{ "<leader>/", LazyVim.pick("live_grep"), desc = "Grep (Root Dir)" },
{ "<leader>:", "<cmd>Telescope command_history<cr>", desc = "Command History" },
{ "<leader><space>", LazyVim.pick("auto"), desc = "Find Files (Root Dir)" },
{ "<leader><space>", LazyVim.pick("files"), desc = "Find Files (Root Dir)" },
-- find
{ "<leader>fb", "<cmd>Telescope buffers sort_mru=true sort_lastused=true<cr>", desc = "Buffers" },
{ "<leader>fc", LazyVim.pick.config_files(), desc = "Find Config File" },
{ "<leader>ff", LazyVim.pick("auto"), desc = "Find Files (Root Dir)" },
{ "<leader>fF", LazyVim.pick("auto", { root = false }), desc = "Find Files (cwd)" },
{ "<leader>ff", LazyVim.pick("files"), desc = "Find Files (Root Dir)" },
{ "<leader>fF", LazyVim.pick("files", { root = false }), desc = "Find Files (cwd)" },
{ "<leader>fg", "<cmd>Telescope git_files<cr>", desc = "Find Files (git-files)" },
{ "<leader>fr", "<cmd>Telescope oldfiles<cr>", desc = "Recent" },
{ "<leader>fR", LazyVim.pick("oldfiles", { cwd = vim.uv.cwd() }), desc = "Recent (cwd)" },
@ -198,6 +198,12 @@ return {
},
},
},
pickers = {
find_files = {
find_command = { "fd", "--type", "f", "--color", "never", "-E", ".git" },
hidden = true,
},
},
}
end,
},

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