add picker for nvim config

This commit is contained in:
Fábio André Damas 2025-03-31 20:58:04 +01:00
parent d4451605c8
commit e2297e4177
2 changed files with 48 additions and 11 deletions

View file

@ -40,13 +40,49 @@ return {
desc = "Project search"
},
-- {
-- "<leader>ds",
-- function()
-- require("utils.telescope").search_dotfiles()
-- end,
-- desc = "Search dot files 🔭",
-- },
{
"<leader>ds",
function()
local function pick_cmd_result(picker_opts)
local git_root = Snacks.git.get_root()
local function finder(opts, ctx)
return require("snacks.picker.source.proc").proc({
opts,
{
cmd = picker_opts.cmd,
args = picker_opts.args,
transform = function(item)
-- item.cwd = picker_opts.cwd or git_root
item.file = item.text
end,
},
}, ctx)
end
Snacks.picker.pick {
source = picker_opts.name,
finder = finder,
preview = picker_opts.preview,
title = picker_opts.title,
}
end
local custom_pickers = {}
function custom_pickers.nvim()
pick_cmd_result {
cmd = "fd",
args = { ".", vim.fn.stdpath('config'), "--type", "f" },
name = "nvim config",
title = "Nvim config",
preview = "file",
}
end
custom_pickers.nvim()
end,
desc = "Search dot files 🔭",
},
{ "K", "<cmd>Lspsaga hover_doc<cr>", desc = "Show documentation" },
{ "<C-k>", "<cmd>Lspsaga hover_doc ++keep<cr>", desc = "Show documentation (keep)" },