Files
dotfiles/nvim/lua/plugins/lsp.lua
Nick Mello 65d08b0772 all: Initial dotfiles
Import an initial copy of all of my dotfiles

Signed-off-by: Nicholas Mello <nick@nmello.dev>
2025-08-14 19:21:24 -05:00

54 lines
1.2 KiB
Lua

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 = {}
},
}