debloat config | remove lspinstall

This commit is contained in:
siduck76 2021-09-10 15:40:54 +05:30
parent 14f0460317
commit 4c025cd1bf
5 changed files with 31 additions and 62 deletions

View File

@ -214,4 +214,11 @@ M.custom.mappings = {
-- }, -- },
} }
M.plugins = {
lspconfig = {
-- servers = {"html", "cssls"}
servers = {},
},
}
return M return M

View File

@ -12,7 +12,7 @@ vim.cmd [[ au TermOpen term://* setlocal nonumber norelativenumber | setfiletype
vim.cmd [[ autocmd BufEnter,BufWinEnter,FileType,WinEnter * lua require("core.utils").hide_statusline() ]] vim.cmd [[ autocmd BufEnter,BufWinEnter,FileType,WinEnter * lua require("core.utils").hide_statusline() ]]
--auto close file exploer when quiting incase a single buffer is left --auto close file exploer when quiting incase a single buffer is left
vim.cmd([[ autocmd BufEnter * if (winnr("$") == 1 && &filetype == 'nvimtree') | q | endif ]]) -- vim.cmd([[ autocmd BufEnter * if (winnr("$") == 1 && &filetype == 'nvimtree') | q | endif ]])
-- Open a file from its last left off position -- Open a file from its last left off position
-- vim.cmd [[ au BufReadPost * if expand('%:p') !~# '\m/\.git/' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif ]] -- vim.cmd [[ au BufReadPost * if expand('%:p') !~# '\m/\.git/' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif ]]

View File

@ -217,4 +217,10 @@ M.custom.mappings = {
-- }, -- },
} }
M.plugins = {
lspconfig = {
-- servers = {"html", "cssls"}
servers = {},
},
}
return M return M

View File

@ -1,7 +1,6 @@
local present1, lspconfig = pcall(require, "lspconfig") local present1, nvim_lsp = pcall(require, "lspconfig")
local present2, lspinstall = pcall(require, "lspinstall")
if not (present1 or present2) then if not present1 then
return return
end end
@ -57,63 +56,24 @@ capabilities.textDocument.completion.completionItem.resolveSupport = {
}, },
} }
-- lspInstall + lspconfig stuff local servers = require("core.utils").load_config().plugins.lspconfig.servers
local function setup_servers() for _, lsp in ipairs(servers) do
lspinstall.setup() nvim_lsp[lsp].setup {
local servers = lspinstall.installed_servers()
for _, lang in pairs(servers) do
if lang ~= "lua" then
lspconfig[lang].setup {
on_attach = on_attach, on_attach = on_attach,
capabilities = capabilities, capabilities = capabilities,
flags = {
debounce_text_changes = 500,
},
-- root_dir = vim.loop.cwd, -- root_dir = vim.loop.cwd,
}
elseif lang == "lua" then
lspconfig[lang].setup {
on_attach = on_attach,
capabilities = capabilities,
flags = { flags = {
debounce_text_changes = 500, debounce_text_changes = 150,
},
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
workspace = {
library = {
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
},
maxPreload = 100000,
preloadFileSize = 10000,
},
telemetry = {
enable = false,
},
},
}, },
} }
end
end
end end
setup_servers() -- require("anyfile").setup_luaLsp(on_attach, capabilities) -- this will be removed soon after the custom hooks PR
-- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim
lspinstall.post_install_hook = function()
setup_servers() -- reload installed servers
vim.cmd "bufdo e"
end
-- replace the default lsp diagnostic symbols -- replace the default lsp diagnostic symbols
local function lspSymbol(name, icon) local function lspSymbol(name, icon)
vim.fn.sign_define("LspDiagnosticsSign" .. name, { text = icon, numhl = "LspDiagnosticsDefaul" .. name }) vim.fn.sign_define("LspDiagnosticsSign" .. name, { text = icon, numhl = "LspDiagnosticsDefault" .. name })
end end
lspSymbol("Error", "") lspSymbol("Error", "")

View File

@ -116,21 +116,17 @@ return packer.startup(function()
} }
-- lsp stuff -- lsp stuff
use { use {
"kabouzeid/nvim-lspinstall", "neovim/nvim-lspconfig",
opt = true, opt = true,
setup = function() setup = function()
require("core.utils").packer_lazy_load "nvim-lspinstall" require("core.utils").packer_lazy_load "nvim-lspconfig"
-- reload the current file so lsp actually starts for it -- reload the current file so lsp actually starts for it
vim.defer_fn(function() vim.defer_fn(function()
vim.cmd "silent! e %" vim.cmd "silent! e %"
end, 0) end, 0)
end, end,
}
use {
"neovim/nvim-lspconfig",
after = "nvim-lspinstall",
config = function() config = function()
require "plugins.configs.lspconfig" require "plugins.configs.lspconfig"
end, end,