local M = { { "folke/trouble.nvim", config = true, dependencies = { "nvim-tree/nvim-web-devicons" }, keys = { { "xx", "Trouble diagnostics toggle", desc = "Diagnostics (Trouble)", }, { "xX", "Trouble diagnostics toggle filter.buf=0", desc = "Buffer Diagnostics (Trouble)", }, { "cs", "Trouble symbols toggle", desc = "Symbols (Trouble)", }, { "cl", "Trouble lsp toggle win.position=right", desc = "LSP Definitions / references / ... (Trouble)", }, { "xL", "Trouble loclist toggle", desc = "Location List (Trouble)", }, { "xQ", "Trouble qflist toggle", desc = "Quickfix List (Trouble)", }, }, opts = { auto_close = true, focus = true, }, }, { "j-hui/fidget.nvim", event = "BufReadPost", opts = { notification = { override_vim_notify = true, }, }, }, { "williamboman/mason.nvim", cmd = "Mason", build = ":MasonUpdate", opts = { ui = { border = "rounded", icons = { package_installed = "✓", package_pending = "➜", package_uninstalled = "✗", }, }, }, }, { "williamboman/mason-lspconfig.nvim", dependencies = { "mason.nvim" }, opts = { ensure_installed = { "lua_ls", "tinymist", }, }, }, { "neovim/nvim-lspconfig", event = "BufReadPre", dependencies = { "mason.nvim", "mason-lspconfig.nvim", }, config = function() vim.diagnostic.config({ float = { focusable = true, style = "minimal", border = "rounded", source = "always", header = "", prefix = "", severity_sort = true, }, virtual_text = { spacing = 4, prefix = "󰊠" }, signs = true, underline = true, update_in_insert = true, severity_sort = true, }) local capabilities = require("blink.cmp").get_lsp_capabilities() vim.lsp.config("*", { capabilities = capabilities, }) -- Use LspAttach autocommand for keybindings vim.api.nvim_create_autocmd("LspAttach", { group = vim.api.nvim_create_augroup("UserLspConfig", { clear = true }), callback = function(ev) local bufnr = ev.buf local function map(modes, keys, command, desc) vim.keymap.set(modes, keys, command, { noremap = true, silent = true, buffer = bufnr, desc = desc, }) end map("n", "gr", "Telescope lsp_references", "LSP References") map("n", "gd", "Telescope lsp_definitions", "LSP Definitions") map("n", "gD", vim.lsp.buf.declaration, "LSP Declarations") map("n", "gi", "Telescope lsp_implementations", "LSP Implementations") map("n", "D", "Telescope diagnostics bufnr=0", "LSP Diagnostics") map("n", "d", vim.diagnostic.open_float, "Inline Diagnostics") map("n", "[d", vim.diagnostic.goto_prev, "Previous Diagnostic") map("n", "]d", vim.diagnostic.goto_next, "Next Diagnostic") map("n", "K", vim.lsp.buf.hover, "Symbol Info") map({ "n", "v" }, "ca", vim.lsp.buf.code_action, "Code Actions") map("n", "rn", vim.lsp.buf.rename, "Smart Rename") map("i", "", vim.lsp.buf.signature_help, "Lsp signature help") map("n", "fm", vim.lsp.buf.format, "Format Document") end, }) end, }, } return M