fix: correct frecency picker invocation in dashboard and key mappings

This commit is contained in:
2024-09-14 17:26:39 -04:00
parent 0affef0abc
commit 725c3533a1
3 changed files with 18 additions and 3 deletions
+2 -2
View File
@@ -24,7 +24,7 @@ M.alpha = {
-- stylua: ignore start
dashboard.section.buttons.val = {
---@diagnostic disable: param-type-mismatch
dashboard.button("f", "" .. " Find file", "<cmd>Telescope frecency workspace=CWD <cr>"),
dashboard.button("f", "" .. " Find file", [[<cmd>lua require("data.func").frecency_picker() <cr>]]),
dashboard.button("n", "" .. " New file", [[<cmd> ene <BAR> startinsert <cr>]]),
dashboard.button("r", "" .. " Recent files", LazyVim.pick("oldfiles")),
dashboard.button("g", "" .. " Grep text", LazyVim.pick("live_grep")),
@@ -51,7 +51,7 @@ M.alpha = {
M.dashboard_nvim = {
choices = {
{ -- Find File
action = "lua LazyVim.pick()()",
action = 'lua require("data.func".frecency_picker()()',
desc = " Find File",
icon = "",
key = "f",
+13
View File
@@ -515,6 +515,19 @@ function M.dump_buffer_to_table(register)
vim.fn.setreg(register, output)
end
---@function Function to open the frecency picker
---@return nil
function M.frecency_picker()
-- Trigger the picker
require("telescope").extensions.frecency.frecency()
-- Remove `A` character that is added by the picker
vim.api.nvim_feedkeys(
vim.api.nvim_replace_termcodes("<BS>", true, true, true),
"n",
false
)
end
---@function Function to reload the user's Neovim configuration
---@return nil
function M.reload_config()
+3 -1
View File
@@ -415,7 +415,9 @@ M.misc = {
},
{ -- Telescope Frecency
lhs = "<leader><leader>",
rhs = "<cmd>Telescope frecency workspace=CWD<cr>",
rhs = function()
require("data.func").frecency_picker()
end,
desc = "Telescope frecency",
},
{ -- Exit Neovim