From ca8106210509542abf6f256d02b41631f436e75a Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Sun, 17 Oct 2021 12:44:44 +0200 Subject: [PATCH] [nvim] feat: use nvim_lsp_installer manage lsp servers through nvim's plugin !!! BREAKING: requires npm check https://github.com/williamboman/nvim-lsp-installer.git --- .config/nvim/lua/plugin/lsp_installer.lua | 29 +++++++++++++++++++++++ .config/nvim/lua/plugins.lua | 9 +++++++ 2 files changed, 38 insertions(+) create mode 100644 .config/nvim/lua/plugin/lsp_installer.lua diff --git a/.config/nvim/lua/plugin/lsp_installer.lua b/.config/nvim/lua/plugin/lsp_installer.lua new file mode 100644 index 0000000..fa6fc46 --- /dev/null +++ b/.config/nvim/lua/plugin/lsp_installer.lua @@ -0,0 +1,29 @@ +-- Author : swytch +-- Created : Saturday Sept. 11, 2021 22:12:33 CET +-- License : GPLv3 +-- Description : nvim-lsp-installer plugin config file + +local lsp_installer = require("nvim-lsp-installer") + +lsp_installer.settings { + ui = { + icons = { + server_installed = "✓", + server_pending = "➜", + server_uninstalled = "✗" + } + } +} + +lsp_installer.on_server_ready(function(server) + local opts = {} + + -- (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 (:help lspconfig-quickstart) + server:setup(opts) + vim.cmd [[ do User LspAttachBuffers ]] +end) diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index dffc26d..5ce4328 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -48,6 +48,15 @@ return require("packer").startup(function() } -- LSP + use { + "williamboman/nvim-lsp-installer", + cmd = { + "LspInstall", + "LspInstallInfo" + }, + config = function() require("plugin.lsp_installer").setup() end + } + use { "neovim/nvim-lspconfig", ft = { "c", "cpp", "lua", "python", "tex"},