mirror of
https://github.com/arkorty/Neolite.git
synced 2026-03-18 00:57:12 +00:00
Add depencency check
Changes to be committed: modified: install.sh modified: lua/lsp-config.lua
This commit is contained in:
21
install.sh
21
install.sh
@@ -1,5 +1,24 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
NPMDP=""
|
||||||
|
if command -v nvim >/dev/null 2>&1 ; then
|
||||||
|
NPMDP="pyright prettier"
|
||||||
|
else
|
||||||
|
echo "No installation of Neovim was found"
|
||||||
|
echo "Quitting now..."
|
||||||
|
exit 127
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if command -v npm >/dev/null 2>&1 ; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
echo "No installation of npm was found"
|
||||||
|
echo "Quitting now..."
|
||||||
|
exit 127
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
[ -d "$HOME/.local/share/nvim/site/pack/packer" ] && rm -rf $HOME/.local/share/nvim/site/pack/packer
|
[ -d "$HOME/.local/share/nvim/site/pack/packer" ] && rm -rf $HOME/.local/share/nvim/site/pack/packer
|
||||||
git clone --depth 1 https://github.com/wbthomason/packer.nvim $HOME/.local/share/nvim/site/pack/packer/start/packer.nvim
|
git clone --depth 1 https://github.com/wbthomason/packer.nvim $HOME/.local/share/nvim/site/pack/packer/start/packer.nvim
|
||||||
|
|
||||||
@@ -8,4 +27,4 @@ git clone --depth 1 https://github.com/wbthomason/packer.nvim $HOME/.local/share
|
|||||||
mkdir -p $HOME/.config/nvim && git clone --depth 1 https://github.com/arkorty/neolite.git $HOME/.config/nvim
|
mkdir -p $HOME/.config/nvim && git clone --depth 1 https://github.com/arkorty/neolite.git $HOME/.config/nvim
|
||||||
|
|
||||||
nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync'
|
nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync'
|
||||||
nvim +TSUpdate "+MasonInstall stylua rustfmt prettier black clang-format"
|
nvim +TSUpdate "+MasonInstall stylua rustfmt black clang-format $NPMDP"
|
||||||
|
|||||||
@@ -1,52 +1,52 @@
|
|||||||
local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig")
|
local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig")
|
||||||
if not lspconfig_status_ok then
|
if not lspconfig_status_ok then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local mason_status_ok, mason = pcall(require, "mason")
|
local mason_status_ok, mason = pcall(require, "mason")
|
||||||
if not mason_status_ok then
|
if not mason_status_ok then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local mason_lspconfig_status_ok, mason_lspconfig = pcall(require, "mason-lspconfig")
|
local mason_lspconfig_status_ok, mason_lspconfig = pcall(require, "mason-lspconfig")
|
||||||
if not mason_lspconfig_status_ok then
|
if not mason_lspconfig_status_ok then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
mason.setup({})
|
mason.setup({})
|
||||||
|
|
||||||
mason_lspconfig.setup({
|
mason_lspconfig.setup({
|
||||||
ensure_installed = { "lua_ls", "rust_analyzer", "clangd", "pyright", "marksman" },
|
ensure_installed = { "lua_ls", "rust_analyzer", "clangd", "marksman" },
|
||||||
})
|
})
|
||||||
|
|
||||||
local cnl_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
local cnl_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
||||||
if not cnl_ok then
|
if not cnl_ok then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local capabilities = cmp_nvim_lsp.default_capabilities()
|
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||||
|
|
||||||
mason_lspconfig.setup_handlers({
|
mason_lspconfig.setup_handlers({
|
||||||
function(server)
|
function(server)
|
||||||
lspconfig[server].setup({
|
lspconfig[server].setup({
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
})
|
})
|
||||||
lspconfig.lua_ls.setup({
|
lspconfig.lua_ls.setup({
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
-- Get the language server to recognize the `vim` global
|
-- Get the language server to recognize the `vim` global
|
||||||
globals = { "vim" },
|
globals = { "vim" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
--["rust_analyzer"] = function()
|
--["rust_analyzer"] = function()
|
||||||
-- local rt_ok, rust_tools = pcall(require, "rust-tools")
|
-- local rt_ok, rust_tools = pcall(require, "rust-tools")
|
||||||
-- if rt_ok then
|
-- if rt_ok then
|
||||||
-- rust_tools.setup({})
|
-- rust_tools.setup({})
|
||||||
-- end
|
-- end
|
||||||
--end,
|
--end,
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user