feat(builtin.keymaps): display noremap/buffer indicators and add lhs filter (#2246)

This commit is contained in:
Xavier Young
2022-11-28 03:04:07 +08:00
committed by GitHub
parent 343a2b6b71
commit 4d77743a8e
4 changed files with 32 additions and 7 deletions

View File

@@ -827,11 +827,23 @@ function make_entry.gen_from_keymaps(opts)
return utils.display_termcodes(entry.lhs)
end
local function get_attr(entry)
local ret = ""
if entry.value.noremap ~= 0 then
ret = ret .. "*"
end
if entry.value.buffer ~= 0 then
ret = ret .. "@"
end
return ret
end
local displayer = require("telescope.pickers.entry_display").create {
separator = "",
items = {
{ width = 2 },
{ width = 3 },
{ width = opts.width_lhs },
{ width = 2 },
{ remaining = true },
},
}
@@ -839,6 +851,7 @@ function make_entry.gen_from_keymaps(opts)
return displayer {
entry.mode,
get_lhs(entry),
get_attr(entry),
get_desc(entry),
}
end