local function map(from, to) vim.keymap.set("n", from, to, { buffer = true, noremap = true, silent = true, }) end return { common = function(client, bufnr) vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") client.server_capabilities.documentFormattingProvider = false if client.name == "gopls" then vim.lsp.codelens.refresh() end map("K", vim.lsp.buf.hover) map("gd", "Telescope lsp_definitions") map("gD", vim.lsp.buf.declaration) map("gr", "Telescope lsp_references") map("gi", "Telescope lsp_implementations") map("gs", vim.lsp.buf.signature_help) map("gl", vim.diagnostic.open_float) map("li", "LspInfo") map("la", vim.lsp.buf.code_action) map("lr", vim.lsp.buf.rename) map("lf", "lua vim.lsp.buf.format {async = true}") map("ls", "Telescope lsp_document_symbols") map("ll", vim.lsp.codelens.run) map("]d", vim.diagnostic.goto_next) map("[d", vim.diagnostic.goto_prev) end, null_ls = function(_, _) map("li", "LspInfo") map("lf", "lua vim.lsp.buf.format {async = true}") map("]d", vim.diagnostic.goto_next) map("[d", vim.diagnostic.goto_prev) end, }