local function map(from, to) vim.keymap.set("n", from, to, { buffer = true, noremap = true, silent = true, }) end return { common = function(client, bufnr) client.server_capabilities.documentFormattingProvider = false if client.name == "gopls" then vim.lsp.codelens.refresh() end if client.name == "clojure_lsp" then client.server_capabilities.documentFormattingProvider = true end if client.server_capabilities.inlayHintProvider then vim.lsp.inlay_hint(bufnr, true) end 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, }