diff --git a/install-nvchad.sh b/install-nvchad.sh index 0b287ee..0eda1a9 100644 --- a/install-nvchad.sh +++ b/install-nvchad.sh @@ -97,19 +97,33 @@ check_and_install_nvchad () 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)" - nvim +MasonInstallAll +qall + nvim +MasonInstallAll +MasonInstall +"MasonInstall clangd" +qall echo -e "${C_LIME}NvChad is now installed !${NO_FORMAT}" 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 () { - 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" else - echo MASON_CONFIG > $NVIM_CONFIG/lua/plugins/custom.lua - echo -e "${C_LIME}Neovim is now customizes !${NO_FORMAT}" + echo $LSPCONFIG > $NVIM_CONFIG/lua/configs/lspconfig.lua + echo -e "${C_LIME}Neovim is now customized !${NO_FORMAT}" 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