misc settings

This commit is contained in:
Alexander Gehrke 2025-05-28 17:30:44 +02:00
parent a3935e52f0
commit 4742d5b88e
5 changed files with 31 additions and 17 deletions

View file

@ -9,6 +9,12 @@ local on_attach = function(args)
end
--
local function diag_jump(count)
return function()
vim.diagnostic.jump({ count = count, float = true })
end
end
-- Mappings.
-- stylua: ignore start
for _, mapping in ipairs({
@ -22,8 +28,9 @@ local on_attach = function(args)
{ '<M-s>', vim.lsp.codelens.run, "Run code lens" },
{ 'gr', function() require('telescope.builtin').lsp_references() end,"Go to references" },
{ '<M-e>', vim.diagnostic.open_float, "Open diagnostics" },
{ '[d', vim.diagnostic.goto_prev, "Go to previous diagnostic" },
{ ']d', vim.diagnostic.goto_next, "Go to next diagnostic" },
{ '[d', diag_jump(-1), "Go to previous diagnostic" },
{ ']d', diag_jump(1), "Go to next diagnostic" },
{ '<F2>', diag_jump(1), "Go to next diagnostic" },
{ '<M-q>', vim.diagnostic.setloclist, "Add buffer diagnostics to location list" },
{ "<leader>dc", function() require("dap").continue() end, "Debug: Continue" },
{ "<leader>dK", function() require("dap.ui.widgets").hover() end, "Debug: Hover" },
@ -47,11 +54,6 @@ local on_attach = function(args)
require("dap").repl.toggle()
end, { silent = true, desc = "Toogle debug REPL" })
if client.server_capabilities.signatureHelpProvider then
vim.cmd([[autocmd CursorHoldI * silent! lua vim.lsp.buf.signature_help()]])
vim.cmd([[autocmd CursorHold * lua vim.diagnostic.open_float({max_width = 100, focusable = false})]])
end
if client.server_capabilities.documentHighlightingProvider then
vim.cmd([[autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()]])
vim.cmd([[autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()]])