vim.api.nvim_create_autocmd("BufWritePre", { callback = function() vim.lsp.buf.format() end, }) return { { "neovim/nvim-lspconfig", dependencies = { { "folke/lazydev.nvim", ft = "lua", -- only load on lua files opts = { library = { -- See the configuration section for more details -- Load luvit types when the `vim.uv` word is found { path = "${3rd}/luv/library", words = { "vim%.uv" } }, }, }, }, }, config = function() local lspconfig = require("lspconfig") lspconfig.lua_ls.setup {} lspconfig.pyright.setup {} lspconfig.bashls.setup {} lspconfig.fish_lsp.setup {} lspconfig.rust_analyzer.setup { root_dir = function(fname) -- Look for Cargo.toml to define project root return lspconfig.util.root_pattern("Cargo.toml")(fname) end, settings = { ["rust-analyzer"] = { cargo = { allFeatures = true }, checkOnSave = { command = "clippy" }, -- Run linter } } } end, }, { -- Quickly install LSPs with internet connection "mason-org/mason.nvim", opts = {} }, }