local lsp = require('lsp-zero') local lsp_config = require("lspconfig") lsp.preset('recommended') lsp.ensure_installed({ 'lua_ls', }) --Enable (broadcasting) snippet capability for completion local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities.textDocument.completion.completionItem.snippetSupport = true lsp_config.html.setup { capabilities = capabilities, filetypes = { "html", "etlua" }, } lsp_config.nim_langserver.setup{ settings = { nim = { projectMapping = { projectFile = "main.nim", fileRegex = ".*\\.nim" } } } } lsp_config.hls.setup{} local cmp = require("cmp") local cmp_select = {behavior = cmp.SelectBehavior.Select} local cmp_mappings = lsp.defaults.cmp_mappings({ [''] = cmp.mapping.select_prev_item(cmp_select), [''] = cmp.mapping.select_next_item(cmp_select), [''] = cmp.mapping.confirm({select = true}), [''] = cmp.mapping.complete(), }) cmp.setup { sources = { -- { name = 'conjure' }, { name = 'nvim_lsp_signature_help' }, { name = 'nvim_lsp' }, { name = 'luasnip' }, } } lsp.set_preferences({ sign_icons = { } }) lsp.setup_nvim_cmp({ mapping = cmp_mappings }) lsp.on_attach(function(client, bufnr) local opts = {buffer = bufnr, remap = false} if client.name == "eslint" then vim.cmd.LspStop('eslint') return end if client.name == "html" or client.name == "cssls" then capabilities = capabilities end vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) vim.keymap.set("n", "vws", vim.lsp.buf.workspace_symbol, opts) vim.keymap.set("n", "vd", vim.diagnostic.open_float, opts) vim.keymap.set("n", "[d", vim.diagnostic.goto_next, opts) vim.keymap.set("n", "]d", vim.diagnostic.goto_prev, opts) vim.keymap.set("n", "vca", vim.lsp.buf.code_action, opts) vim.keymap.set("n", "vrr", vim.lsp.buf.references, opts) vim.keymap.set("n", "vrn", vim.lsp.buf.rename, opts) vim.keymap.set("i", "", vim.lsp.buf.signature_help, opts) end) lsp_config.lua_ls.setup { -- ... other configs settings = { Lua = { diagnostics = { globals = { 'vim' } } } } } lsp_config.racket_langserver.setup{} lsp.setup()