Add default lsp config

This commit is contained in:
Ninjdai 2024-10-23 22:17:32 +02:00
parent 03c0e411cf
commit 78ba15b96c

View File

@ -97,19 +97,33 @@ check_and_install_nvchad ()
git clone https://github.com/NvChad/starter $NVIM_CONFIG git clone https://github.com/NvChad/starter $NVIM_CONFIG
read -p "Neovim is about to launch. After it has finished installing plugins, it should automatically exit ! (Press Enter to continue)" read -p "Neovim is about to launch. After it has finished installing plugins, it should automatically exit ! (Press Enter to continue)"
nvim +MasonInstallAll +qall nvim +MasonInstallAll +MasonInstall +"MasonInstall clangd" +qall
echo -e "${C_LIME}NvChad is now installed !${NO_FORMAT}" echo -e "${C_LIME}NvChad is now installed !${NO_FORMAT}"
fi fi
} }
LSPCONFIG='require("nvchad.configs.lspconfig").defaults()
local lspconfig = require "lspconfig"
local servers = { "html", "cssls", "clangd" }
local nvlsp = require "nvchad.configs.lspconfig"
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
on_attach = nvlsp.on_attach,
on_init = nvlsp.on_init,
capabilities = nvlsp.capabilities,
}
end'
customize_nvim () customize_nvim ()
{ {
if [ -f /tmp/nvchad-installer/JetBrainsMono.zip ]; then if ! [[ echo "9c3bf1ed3d48d091bf791f1b923493f3e5ecf723 $NVIM_CONFIG/lua/custom/configs/lspconfig.lua" | sha1sum -c - ]]; then
echo "Looks like Neovim is already customized, skipping customization" echo "Looks like Neovim is already customized, skipping customization"
else else
echo MASON_CONFIG > $NVIM_CONFIG/lua/plugins/custom.lua echo $LSPCONFIG > $NVIM_CONFIG/lua/configs/lspconfig.lua
echo -e "${C_LIME}Neovim is now customizes !${NO_FORMAT}" echo -e "${C_LIME}Neovim is now customized !${NO_FORMAT}"
fi fi
} }
@ -122,18 +136,4 @@ cleanup ()
} }
MASON_CONFIG = 'return {
{
"williamboman/mason.nvim",
opts = {
ensure_installed = {
"lua-language-server", "stylua",
"html-lsp", "css-lsp" , "prettier",
"clangd", "clang-format"
},
},
},
}'
main main