1
0

39 lines
1.3 KiB
Lua

-- lua/plugins/mappings.lua
return {
{
"AstroNvim/astrocore",
---@type AstroCoreOpts
opts = {
mappings = {
n = {
-- Your existing AstroCore normal mode mappings would be here
-- For example:
-- ["<Leader>bn"] = { "<cmd>tabnew<cr>", desc = "New tab" },
-- Add your new mapping for "Leader f z" here
["<Leader>fz"] = {
function()
-- The updated regex to find "fn " followed by ANY valid Zig identifier, then an opening parenthesis
-- Explanation of the new regex:
-- fn : Matches the literal string "fn"
-- \\s+ : Matches one or more whitespace characters
-- \\w+ : Matches one or more "word" characters (letters, numbers, underscore) - this covers any function name
-- \\( : Matches the literal opening parenthesis (escaped because '(' is a special regex character)
local pattern = "fn\\s+"
require("telescope.builtin").live_grep {
default_text = pattern,
prompt_title = "Find Zig Functions",
file_types = { "zig" },
rg_opts = { "--case-insensitive" },
}
end,
desc = "Find all function definitions in Zig files",
},
},
},
},
},
}