not quite sure what I've done here

This commit is contained in:
Squibid 2025-11-22 17:22:23 -05:00
parent b22873f45f
commit 83aaa5aef3
Signed by: squibid
GPG key ID: BECE5684D3C4005D
18 changed files with 392 additions and 392 deletions

View file

@ -8,8 +8,8 @@ local function on_list(opts)
-- get to the closest reference to the cursor (likely the one gr or gd was
-- called on)
--
-- TODO: switch this to use opts.idx?
--
-- TODO: switch this to use opts.idx?
local closest, distance = 1, false
for i, item in ipairs(opts.items) do
if item.filename and vim.fn.expand("%:p") == item.filename then
@ -37,32 +37,32 @@ end
local group = misc.augroup("lsp.bind")
auto("LspAttach", {
group = group,
callback = function(ctx)
local list_opts = { on_list = on_list }
local opts = { buffer = ctx.buf, nowait = true }
group = group,
callback = function(ctx)
local list_opts = { on_list = on_list }
local opts = { buffer = ctx.buf, nowait = true }
-- LSP actions
map("n", "K", vim.lsp.buf.hover, opts)
map("n", "gd", function() vim.lsp.buf.definition(list_opts) end, opts)
map("n", "gD", function() vim.lsp.buf.declaration(list_opts) end, opts)
map("n", "gi", function() vim.lsp.buf.implementation(list_opts) end, opts)
map("n", "gy", function() vim.lsp.buf.type_definition(list_opts) end, opts)
map("n", "gr", function() vim.lsp.buf.references(nil, list_opts) end, opts)
map("n", "<S-Tab>", vim.lsp.buf.signature_help, opts)
map("n", "<leader>r", vim.lsp.buf.rename, opts)
map("n", "gA", vim.lsp.buf.code_action, opts)
-- LSP actions
map("n", "K", vim.lsp.buf.hover, opts)
map("n", "gd", function() vim.lsp.buf.definition(list_opts) end, opts)
map("n", "gD", function() vim.lsp.buf.declaration(list_opts) end, opts)
map("n", "gi", function() vim.lsp.buf.implementation(list_opts) end, opts)
map("n", "gy", function() vim.lsp.buf.type_definition(list_opts) end, opts)
map("n", "gr", function() vim.lsp.buf.references(nil, list_opts) end, opts)
map("n", "<S-Tab>", vim.lsp.buf.signature_help, opts)
map("n", "<leader>r", vim.lsp.buf.rename, opts)
map("n", "gA", vim.lsp.buf.code_action, opts)
-- Diagnostics
map("n", "[d", function()
vim.diagnostic.jump({ count = -1 })
end, opts)
map("n", "]d", function()
vim.diagnostic.jump({ count = 1 })
end, opts)
map("n", "gb", vim.diagnostic.setqflist, opts)
-- Diagnostics
map("n", "[d", function()
vim.diagnostic.jump({ count = -1 })
end, opts)
map("n", "]d", function()
vim.diagnostic.jump({ count = 1 })
end, opts)
map("n", "gb", vim.diagnostic.setqflist, opts)
-- formatting
map("n", "<leader>c", vim.lsp.buf.format)
end
-- formatting
map("n", "<leader>c", vim.lsp.buf.format)
end
})