aboutsummaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'plugin')
-rw-r--r--plugin/lsp.vim70
1 files changed, 43 insertions, 27 deletions
diff --git a/plugin/lsp.vim b/plugin/lsp.vim
index 7905181..0c5b6fe 100644
--- a/plugin/lsp.vim
+++ b/plugin/lsp.vim
@@ -62,32 +62,48 @@ local function on_attach()
vim.api.nvim_set_keymap('n', 'K', ':lua vim.lsp.buf.hover()<cr>', {noremap = true})
end
-local function setup_servers()
- require'lspinstall'.setup()
- local servers = require'lspinstall'.installed_servers()
- for _, server in pairs(servers) do
- if server == 'lua' then
- require'lspconfig'.lua.setup {
- on_attach=on_attach,
- settings = {
- Lua = {
- diagnostics = {
- globals = { 'vim' }
- }
- }
- },
- }
- else
- require'lspconfig'[server].setup{ on_attach=on_attach }
- end
- end
-end
-
-setup_servers()
-
-require'lspinstall'.post_install_hook = function ()
- setup_servers()
- vim.cmd("bufdo e")
-end
+local lsp_installer = require("nvim-lsp-installer")
+
+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
+ opts.on_attach = on_attach
+
+ -- This setup() function is exactly the same as lspconfig's setup function (:help lspconfig-quickstart)
+ server:setup(opts)
+ vim.cmd [[ do User LspAttachBuffers ]]
+end)
+
+-- local function setup_servers()
+-- require'lspinstall'.setup()
+-- local servers = require'lspinstall'.installed_servers()
+-- for _, server in pairs(servers) do
+-- if server == 'lua' then
+-- require'lspconfig'.lua.setup {
+-- on_attach=on_attach,
+-- settings = {
+-- Lua = {
+-- diagnostics = {
+-- globals = { 'vim' }
+-- }
+-- }
+-- },
+-- }
+-- else
+-- require'lspconfig'[server].setup{ on_attach=on_attach }
+-- end
+-- end
+-- end
+
+-- setup_servers()
+
+-- require'lspinstall'.post_install_hook = function ()
+-- setup_servers()
+-- vim.cmd("bufdo e")
+-- end
EOF