return { "neovim/nvim-lspconfig", dependencies = { "hrsh7th/cmp-nvim-lsp", "onsails/lspkind.nvim", }, config = function() local lspconfig = require("lspconfig") local cmp_nvim_lsp = require("cmp_nvim_lsp") local wk = require("which-key") local capabilities = cmp_nvim_lsp.default_capabilities() lspconfig["lua_ls"].setup({ capabilities = capabilities, settings = { -- custom settings for lua Lua = { -- make the language server recognize "vim" global diagnostics = { globals = { "vim" }, }, workspace = { -- make language server aware of runtime files library = { [vim.fn.expand("$VIMRUNTIME/lua")] = true, [vim.fn.stdpath("config") .. "/lua"] = true, }, }, }, }, }) lspconfig["pyright"].setup({ capabilities = capabilities, filetypes = { "python" }, }) lspconfig["clangd"].setup({ capabilities = capabilities, }) lspconfig["marksman"].setup({ capabilities = capabilities, }) lspconfig["texlab"].setup({ capabilities = capabilities, }) wk.register({ l = { name = "lsp", r = { "Telescope lsp_references", "Show references" }, D = { "lua vim.lsp.buf.defenition()", "Show defenition" }, c = { "lua vim.lsp.buf.code_action()", "Code actions" }, R = { "lua vim.lsp.buf.rename()", "Smart rename" }, d = { "Telescope diagnostics bufnr=0", "Diagnostics" }, l = { "lua vim.lsp.buf.open_float()", "Line Diagnostics" }, n = { "lua vim.diagnostics.goto_next()", "Go to next Diagnostic" }, p = { "lua vim.diagnostics.goto_prev()", "Go to previous Diagnostic" }, i = { "lua vim.lsp.buf.hover()", "Show documentation" }, L = { "LspRestart", "Restart LSP" }, }, }, { prefix = "" }) end, }