return { { "williamboman/mason.nvim", config = function() require("mason").setup({ ui = { border = "rounded", }, }) end, }, { "williamboman/mason-lspconfig.nvim", dependencies = { "williamboman/mason.nvim" }, config = function() require("mason-lspconfig").setup({ ensure_installed = { "lua_ls", -- Lua "pyright", -- Python "tsserver", -- TypeScript/JavaScript "clangd", -- C/C++ "rust_analyzer", -- Rust "gopls", -- Go }, automatic_installation = true, }) end, }, { "neovim/nvim-lspconfig", dependencies = { "williamboman/mason-lspconfig.nvim" }, config = function() local lspconfig = require("lspconfig") -- Language Server Configurations local servers = { lua_ls = { settings = { Lua = { diagnostics = { globals = { "vim" }, -- Avoid undefined 'vim' warnings }, workspace = { library = vim.api.nvim_get_runtime_file("", true), checkThirdParty = false, }, }, }, }, pyright = {}, tsserver = {}, clangd = {}, rust_analyzer = {}, gopls = {}, } for server, config in pairs(servers) do lspconfig[server].setup(config) end -- LSP Keybindings vim.api.nvim_create_autocmd("LspAttach", { callback = function(event) local opts = { buffer = event.buf, noremap = true, silent = true } -- Keymaps vim.keymap.set("n", "gd", "lua vim.lsp.buf.definition()", opts) vim.keymap.set("n", "gr", "lua vim.lsp.buf.references()", opts) vim.keymap.set("n", "K", "lua vim.lsp.buf.hover()", opts) vim.keymap.set("n", "rn", "lua vim.lsp.buf.rename()", opts) vim.keymap.set("n", "ca", "lua vim.lsp.buf.code_action()", opts) vim.keymap.set("n", "f", "lua vim.lsp.buf.format({ async = true })", opts) end, }) end, }, }