register lsp mappings for buffer only

This commit is contained in:
siduck 2022-05-24 23:01:35 +05:30
parent 16d5451594
commit c7cfacd360
3 changed files with 18 additions and 7 deletions

View file

@ -18,9 +18,19 @@ win.default_opts = function(options)
return opts
end
function M.on_attach(client, _)
M.on_attach = function(client, bufnr)
client.resolved_capabilities.document_formatting = false
client.resolved_capabilities.document_range_formatting = false
local lsp_mappings = nvchad.load_config().mappings.lspconfig
local wk_exists, wk = pcall(require, "which-key")
if wk_exists then
wk.register(lsp_mappings.n, { buffer = bufnr })
else
-- todo, make use of bufnr here
-- add no whichkey func logic here
end
end
local capabilities = vim.lsp.protocol.make_client_capabilities()