Skip to content

Instantly share code, notes, and snippets.

@matheusxreis
Created October 15, 2023 23:03
Show Gist options
  • Save matheusxreis/5848062a65f2a4bb2bde12cf651cec3d to your computer and use it in GitHub Desktop.
Save matheusxreis/5848062a65f2a4bb2bde12cf651cec3d to your computer and use it in GitHub Desktop.
config lsp rust in nvim with nvchad
-- ~/.config/nvim/lua/custom/chadrc.lua
---@type ChadrcConfig
local M = {}
M.ui = { theme = 'jellybeans' }
M.plugins = 'custom.plugins'
return M
-- ~/.config/nvim/lua/custom/configs/lspconfig.lua
local on_attach = require("plugins.configs.lspconfig").on_attach
local capabilites = require("plugins.configs.lspconfig").capabilities
local lspconfig = require("lspconfig")
lspconfig.rust_analyzer.setup({
on_attach = on_attach,
capabilities = capabilites,
filetypes = {"rust"},
root_dir = lspconfig.util.root_pattern("Cargo.toml"),
settings = {
['rust-analyzer'] = {
cargo = {
allFeatures = true
}
}
}
})
-- ~/.config/nvim/lua/custom/plugins.lua
local plugins = {
{
"neovim/nvim-lspconfig",
config = function()
require "plugins.configs.lspconfig"
require "custom.configs.lspconfig"
end,
}
}
return plugins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment