mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-28 03:30:12 +02:00
fix(illuminate): always set refernce keymaps on the buffer as well to properly overwrite ftplugin mappings. Fixes #292
This commit is contained in:
parent
ba7942b80b
commit
a0cf00c81b
1 changed files with 15 additions and 5 deletions
|
@ -261,18 +261,28 @@ return {
|
||||||
opts = { delay = 200 },
|
opts = { delay = 200 },
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
require("illuminate").configure(opts)
|
require("illuminate").configure(opts)
|
||||||
|
|
||||||
|
local function map(key, dir, buffer)
|
||||||
|
vim.keymap.set("n", key, function()
|
||||||
|
require("illuminate")["goto_" .. dir .. "_reference"](false)
|
||||||
|
end, { desc = dir:sub(1, 1):upper() .. dir:sub(2) .. " Reference", buffer = buffer })
|
||||||
|
end
|
||||||
|
|
||||||
|
map("]]", "next")
|
||||||
|
map("[[", "prev")
|
||||||
|
|
||||||
|
-- also set it after loading ftplugins, since a lot overwrite [[ and ]]
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
callback = function()
|
callback = function()
|
||||||
local buffer = vim.api.nvim_get_current_buf()
|
local buffer = vim.api.nvim_get_current_buf()
|
||||||
pcall(vim.keymap.del, "n", "]]", { buffer = buffer })
|
map("]]", "next", buffer)
|
||||||
pcall(vim.keymap.del, "n", "[[", { buffer = buffer })
|
map("[[", "prev", buffer)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
-- stylua: ignore
|
|
||||||
keys = {
|
keys = {
|
||||||
{ "]]", function() require("illuminate").goto_next_reference(false) end, desc = "Next Reference", },
|
{ "]]", desc = "Next Reference" },
|
||||||
{ "[[", function() require("illuminate").goto_prev_reference(false) end, desc = "Prev Reference" },
|
{ "[[", desc = "Prev Reference" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue