feat: add keymap for gR (go references)

This commit is contained in:
Johannes Kresner committed 2026-11-13 13:58:11 +01:00
1 parent a593a5aae3
commit 9b9e43558b
1 file changed
+10
+10
View File
@@ -50,6 +50,16 @@ map({ "n", "x", "o" }, "<A-i>", function()
end
end, { desc = "Select child node" })
-- Go to references: jump directly when there is one, quickfix list otherwise
map("n", "gR", function()
vim.lsp.buf.references(nil, {
on_list = function(o)
vim.fn.setqflist({}, " ", o)
vim.cmd(#o.items == 1 and "cfirst" or "copen")
end,
})
end, { desc = "Go to references" })
map("n", "<leader>fl", function()
local value = vim.fn.fnamemodify(vim.fn.expand("%"), ":~:.") .. ":" .. vim.fn.line(".")
vim.fn.setreg("+", value)