feat(neorg): Telescope live_grep in neorg working directory

This commit is contained in:
Fabrice Mouhartem 2024-12-11 15:42:38 +01:00
parent 4f45e89025
commit 398736176c
Signed by: fmouhart
GPG Key ID: 2C5033B228CFE4E7

View File

@ -36,6 +36,13 @@ vim.api.nvim_create_autocmd({ "FileType" }, {
end,
})
local function live_grep_neorg()
local neorg_root = '~/Sync/neorg' -- TODO: get it from neorg
require('telescope.builtin').live_grep {
cwd = neorg_root,
}
end
-- document existing key chains
require('which-key').add {
{ "<leader>l", group = "neorg [L]ist" },
@ -69,3 +76,5 @@ vim.api.nvim_set_keymap("n", "<Leader>nl", "<Plug>(neorg.telescope.find_linkable
{ noremap = true, silent = true, desc = "[N]eorg find [L]inkable" })
vim.api.nvim_set_keymap("n", "<Leader>nf", "<Plug>(neorg.telescope.find_norg_files)",
{ noremap = true, silent = true, desc = "[N]eorg find [F]ile" })
vim.keymap.set("n", "<Leader>n/", live_grep_neorg,
{ noremap = true, silent = true, desc = "[N]eorg Live Grep" })