fix(which_key): only get telescope mappings (#2090)

This commit is contained in:
Fabian David Schmidt
2022-07-19 22:43:31 +03:00
committed by GitHub
parent 6bddc38c25
commit 8c56301720

View File

@@ -96,8 +96,11 @@ function utils.get_registered_mappings(prompt_bufnr)
for _, mode in ipairs { "n", "i" } do for _, mode in ipairs { "n", "i" } do
local mode_mappings = vim.api.nvim_buf_get_keymap(prompt_bufnr, mode) local mode_mappings = vim.api.nvim_buf_get_keymap(prompt_bufnr, mode)
for _, mapping in ipairs(mode_mappings) do for _, mapping in ipairs(mode_mappings) do
local funcid = findnth(mapping.rhs, 2) -- ensure only telescope mappings
table.insert(ret, { mode = mode, keybind = mapping.lhs, func = __TelescopeKeymapStore[prompt_bufnr][funcid] }) if mapping.rhs and string.find(mapping.rhs, [[require%('telescope.mappings'%).execute_keymap]]) then
local funcid = findnth(mapping.rhs, 2)
table.insert(ret, { mode = mode, keybind = mapping.lhs, func = __TelescopeKeymapStore[prompt_bufnr][funcid] })
end
end end
end end
return ret return ret