1
0

Added custom telescope function Leader-f-z to search for zig function

This commit is contained in:
Adrien Bouvais 2025-07-03 22:52:07 +00:00
parent 4ec9c667a3
commit c070507503
5 changed files with 59 additions and 9 deletions

3
.config/nvim/.luarc.json Normal file
View File

@ -0,0 +1,3 @@
{
"format.enable": false
}

View File

@ -1,10 +1,18 @@
-- This file simply bootstraps the installation of Lazy.nvim and then calls other files for execution
-- This file doesn't necessarily need to be touched, BE CAUTIOUS editing this file and proceed at your own risk.
local lazypath = vim.env.LAZY or vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
if not (vim.env.LAZY or (vim.uv or vim.loop).fs_stat(lazypath)) then
-- stylua: ignore
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
local result = vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
if vim.v.shell_error ~= 0 then
-- stylua: ignore
vim.api.nvim_echo({ { ("Error cloning lazy.nvim:\n%s\n"):format(result), "ErrorMsg" }, { "Press any key to exit...", "MoreMsg" } }, true, {})
vim.fn.getchar()
vim.cmd.quit()
end
end
vim.opt.rtp:prepend(lazypath)
-- validate that lazy is available
@ -17,3 +25,5 @@ end
require "lazy_setup"
require "polish"
vim.opt.clipboard = 'unnamedplus'

View File

@ -1,13 +1,14 @@
{
"AstroNvim": { "branch": "main", "commit": "212c8586037022179d3c91db7a485b8559e045be" },
"AstroNvim": { "branch": "main", "commit": "5adafa02ab066326f911160dd6c73d758407fe46" },
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" },
"aerial.nvim": { "branch": "master", "commit": "3284a2cb858ba009c79da87d5e010ccee3c99c4d" },
"astrocommunity": { "branch": "main", "commit": "6f3e4a5606e51e174f51a63e3b8f4a8f12f1f19b" },
"astrocore": { "branch": "main", "commit": "c797dd5a592e2bd154f2503e231b8a4083659534" },
"astrolsp": { "branch": "main", "commit": "c45d9a1863e3ef430cee834674601bc50a304a70" },
"astrolsp": { "branch": "main", "commit": "414775e4b49a46bd7105cc5498ea7bb312359bf2" },
"astrotheme": { "branch": "main", "commit": "f12dcf64b1f9a05839c3ac2146f550f43bae9dab" },
"astroui": { "branch": "main", "commit": "fded232ee0001c6bed9b654188e3dd4b0c58317c" },
"better-escape.nvim": { "branch": "master", "commit": "199dcc2643dec5d8dbdab4ec672cf405224dcb3b" },
"blink.cmp": { "branch": "main", "commit": "022521a8910a5543b0251b21c9e1a1e989745796" },
"blink.cmp": { "branch": "main", "commit": "9bcb14b43852a6f2bfd5ac9ef29cb5cf09b1b39b" },
"blink.compat": { "branch": "main", "commit": "2ed6d9a28b07fa6f3bface818470605f8896408c" },
"cmp-dap": { "branch": "master", "commit": "ea92773e84c0ad3288c3bc5e452ac91559669087" },
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
@ -19,11 +20,11 @@
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
"mason-null-ls.nvim": { "branch": "main", "commit": "2b8433f76598397fcc97318d410e0c4f7a4bea6a" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "75d60a8f928decd8b38897f80849768b7c540a5b" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "93a9ff9b34c91c0cb0f7de8d5f7e4abce51d8903" },
"mason.nvim": { "branch": "main", "commit": "7f265cd6ae56cecdd0aa50c8c73fc593b0604801" },
"mini.icons": { "branch": "main", "commit": "397ed3807e96b59709ef3292f0a3e253d5c1dc0a" },
"neo-tree.nvim": { "branch": "main", "commit": "f481de16a0eb59c985abac8985e3f2e2f75b4875" },
"neoconf.nvim": { "branch": "main", "commit": "3da00bcf27265e2115d82160756d80312580035a" },
"neoconf.nvim": { "branch": "main", "commit": "5ebd6c29c88931fe7c603f087b4c32ac8157d901" },
"none-ls.nvim": { "branch": "main", "commit": "db2a48b79cfcdab8baa5d3f37f21c78b6705c62e" },
"nui.nvim": { "branch": "main", "commit": "f535005e6ad1016383f24e39559833759453564e" },
"nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" },

View File

@ -1,5 +1,3 @@
if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
-- AstroCommunity: import any community modules here
-- We import this file in `lazy_setup.lua` before the `plugins/` folder.
-- This guarantees that the specs are processed before any user plugins.
@ -8,5 +6,5 @@ if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
return {
"AstroNvim/astrocommunity",
{ import = "astrocommunity.pack.lua" },
-- import/override with your plugins folder
"nvim-telescope/telescope.nvim",
}

View File

@ -0,0 +1,38 @@
-- 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",
},
},
},
},
},
}