register lsp mappings for buffer only
This commit is contained in:
parent
16d5451594
commit
c7cfacd360
|
@ -18,9 +18,19 @@ win.default_opts = function(options)
|
||||||
return opts
|
return opts
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.on_attach(client, _)
|
M.on_attach = function(client, bufnr)
|
||||||
client.resolved_capabilities.document_formatting = false
|
client.resolved_capabilities.document_formatting = false
|
||||||
client.resolved_capabilities.document_range_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
|
end
|
||||||
|
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
|
|
@ -66,7 +66,8 @@ mappings.groups = nil
|
||||||
-- register mappings
|
-- register mappings
|
||||||
local function register_mappings(maps, opts)
|
local function register_mappings(maps, opts)
|
||||||
for mode, opt in pairs(opts.mode_opts) do
|
for mode, opt in pairs(opts.mode_opts) do
|
||||||
for _, value in pairs(maps) do
|
for key, value in pairs(maps) do
|
||||||
|
if key ~= "lspconfig" then
|
||||||
if value[mode] then
|
if value[mode] then
|
||||||
local mode_opts = value["mode_opts"] and vim.tbl_deep_extend("force", opt, value["mode_opts"]) or opt
|
local mode_opts = value["mode_opts"] and vim.tbl_deep_extend("force", opt, value["mode_opts"]) or opt
|
||||||
wk.register(value[mode], mode_opts)
|
wk.register(value[mode], mode_opts)
|
||||||
|
@ -74,9 +75,9 @@ local function register_mappings(maps, opts)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
register_mappings(mappings, options)
|
register_mappings(mappings, options)
|
||||||
register_mappings(mapping_groups, options)
|
register_mappings(mapping_groups, options)
|
||||||
|
|
||||||
|
|
||||||
wk.setup(options)
|
wk.setup(options)
|
||||||
|
|
|
@ -186,7 +186,7 @@ local plugins = {
|
||||||
|
|
||||||
-- file managing , picker etc
|
-- file managing , picker etc
|
||||||
["kyazdani42/nvim-tree.lua"] = {
|
["kyazdani42/nvim-tree.lua"] = {
|
||||||
ft = 'alpha',
|
ft = "alpha",
|
||||||
cmd = { "NvimTreeToggle", "NvimTreeFocus" },
|
cmd = { "NvimTreeToggle", "NvimTreeFocus" },
|
||||||
config = function()
|
config = function()
|
||||||
require "plugins.configs.nvimtree"
|
require "plugins.configs.nvimtree"
|
||||||
|
|
Loading…
Reference in New Issue