diff --git a/lua/pluginList.lua b/lua/pluginList.lua index e411eec..44fe077 100644 --- a/lua/pluginList.lua +++ b/lua/pluginList.lua @@ -33,9 +33,9 @@ return require('packer').startup(function(use) } -- lsp stuff - use {'neovim/nvim-lspconfig', event = "VimEnter"} + use {'neovim/nvim-lspconfig', event = "BufEnter"} use { - 'kabouzeid/nvim-lspinstall', + 'williamboman/nvim-lsp-installer', config = function() require "plugins.lspinstall" end, after = 'nvim-lspconfig' } @@ -57,7 +57,7 @@ return require('packer').startup(function(use) use { 'ms-jpq/coq_nvim', branch = 'coq', - after = 'nvim-lspinstall', + after = 'nvim-lsp-installer', run = ':COQdeps', config = function() require "plugins.coq" end } @@ -134,7 +134,7 @@ return require('packer').startup(function(use) use { "Pocco81/TrueZen.nvim", cmd = {'TZAtaraxis', 'TZFocus', 'TZMinimalist'}, - config = function() require "plugins.truezen" end + config = function() require "plugins.truezen" end } use { "lukas-reineke/indent-blankline.nvim", diff --git a/lua/plugins/lspinstall.lua b/lua/plugins/lspinstall.lua index 28bd0ea..081807c 100644 --- a/lua/plugins/lspinstall.lua +++ b/lua/plugins/lspinstall.lua @@ -1,17 +1,17 @@ -local function setup_servers() - require'lspinstall'.setup() - local servers = require'lspinstall'.installed_servers() - for _, server in pairs(servers) do - require'lspconfig'[server].setup{} - end -end +local lsp_installer = require("nvim-lsp-installer") -setup_servers() +-- Register a handler that will be called for all installed servers. +-- Alternatively, you may also register handlers on specific server instances instead (see example below). +lsp_installer.on_server_ready(function(server) + local opts = {} --- Automatically reload after `:LspInstall ` so we don't have to restart neovim -require'lspinstall'.post_install_hook = function () - setup_servers() -- reload installed servers - vim.cmd("bufdo e") -- this triggers the FileType autocmd that starts the server -end + -- (optional) Customize the options passed to the server + -- if server.name == "tsserver" then + -- opts.root_dir = function() ... end + -- end + + -- This setup() function is exactly the same as lspconfig's setup function. + -- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md + server:setup(opts) +end) -vim.cmd(':LspStart')