debloat config | remove lspinstall
This commit is contained in:
		
							parent
							
								
									14f0460317
								
							
						
					
					
						commit
						4c025cd1bf
					
				| @ -214,4 +214,11 @@ M.custom.mappings = { | ||||
|    -- }, | ||||
| } | ||||
| 
 | ||||
| M.plugins = { | ||||
|    lspconfig = { | ||||
|       -- servers = {"html", "cssls"} | ||||
|       servers = {}, | ||||
|    }, | ||||
| } | ||||
| 
 | ||||
| return M | ||||
|  | ||||
| @ -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() ]] | ||||
| 
 | ||||
| --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 | ||||
| -- vim.cmd [[ au BufReadPost * if expand('%:p') !~# '\m/\.git/' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif ]] | ||||
|  | ||||
| @ -217,4 +217,10 @@ M.custom.mappings = { | ||||
|    -- }, | ||||
| } | ||||
| 
 | ||||
| M.plugins = { | ||||
|    lspconfig = { | ||||
|       -- servers = {"html", "cssls"} | ||||
|       servers = {}, | ||||
|    }, | ||||
| } | ||||
| return M | ||||
|  | ||||
| @ -1,7 +1,6 @@ | ||||
| local present1, lspconfig = pcall(require, "lspconfig") | ||||
| local present2, lspinstall = pcall(require, "lspinstall") | ||||
| local present1, nvim_lsp = pcall(require, "lspconfig") | ||||
| 
 | ||||
| if not (present1 or present2) then | ||||
| if not present1 then | ||||
|    return | ||||
| 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() | ||||
|    lspinstall.setup() | ||||
|    local servers = lspinstall.installed_servers() | ||||
| 
 | ||||
|    for _, lang in pairs(servers) do | ||||
|       if lang ~= "lua" then | ||||
|          lspconfig[lang].setup { | ||||
|             on_attach = on_attach, | ||||
|             capabilities = capabilities, | ||||
|             flags = { | ||||
|                debounce_text_changes = 500, | ||||
|             }, | ||||
|             -- root_dir = vim.loop.cwd, | ||||
|          } | ||||
|       elseif lang == "lua" then | ||||
|          lspconfig[lang].setup { | ||||
|             on_attach = on_attach, | ||||
|             capabilities = capabilities, | ||||
|             flags = { | ||||
|                debounce_text_changes = 500, | ||||
|             }, | ||||
|             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 | ||||
| for _, lsp in ipairs(servers) do | ||||
|    nvim_lsp[lsp].setup { | ||||
|       on_attach = on_attach, | ||||
|       capabilities = capabilities, | ||||
|       -- root_dir = vim.loop.cwd, | ||||
|       flags = { | ||||
|          debounce_text_changes = 150, | ||||
|       }, | ||||
|    } | ||||
| end | ||||
| 
 | ||||
| setup_servers() | ||||
| 
 | ||||
| -- 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 | ||||
| -- require("anyfile").setup_luaLsp(on_attach, capabilities) -- this will be removed soon after the custom hooks PR | ||||
| 
 | ||||
| -- replace the default lsp diagnostic symbols | ||||
| 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 | ||||
| 
 | ||||
| lspSymbol("Error", "") | ||||
|  | ||||
| @ -116,21 +116,17 @@ return packer.startup(function() | ||||
|    } | ||||
| 
 | ||||
|    -- lsp stuff | ||||
| 
 | ||||
|    use { | ||||
|       "kabouzeid/nvim-lspinstall", | ||||
|       "neovim/nvim-lspconfig", | ||||
|       opt = true, | ||||
|       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 | ||||
|          vim.defer_fn(function() | ||||
|             vim.cmd "silent! e %" | ||||
|          end, 0) | ||||
|       end, | ||||
|    } | ||||
| 
 | ||||
|    use { | ||||
|       "neovim/nvim-lspconfig", | ||||
|       after = "nvim-lspinstall", | ||||
|       config = function() | ||||
|          require "plugins.configs.lspconfig" | ||||
|       end, | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user