From 5fac9a1bc992bed6e25af7abb4222b373c7f243a Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 6 Aug 2022 16:14:08 +1000 Subject: [PATCH] chore(mappings): add desc to all mappings --- lua/nvim-tree/renderer/help.lua | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/lua/nvim-tree/renderer/help.lua b/lua/nvim-tree/renderer/help.lua index 13b73bdc..3dddd468 100644 --- a/lua/nvim-tree/renderer/help.lua +++ b/lua/nvim-tree/renderer/help.lua @@ -10,22 +10,14 @@ local function tidy_lhs(lhs) end -- uppercase ctrls - if lhs:match "^") -local function shorten_lhs(lhs) return lhs - :gsub("LeftMouse>$", "LM>") - :gsub("RightMouse>$", "RM>") - :gsub("MiddleMouse>$", "MM>") - :gsub("ScrollWheelDown>$", "SD>") - :gsub("ScrollWheelUp>$", "SU>") - :gsub("ScrollWheelLeft>$", "SL>") - :gsub("ScrollWheelRight>$", "SR>") end -- sort lhs roughly as per :help index @@ -78,19 +70,16 @@ function M.compute_lines() return sort_lhs(a.lhs, b.lhs) end) - for _, p in pairs(lines) do - p.lhs = shorten_lhs(p.lhs) - end - local num = 0 for _, p in pairs(lines) do num = num + 1 - local bind_string = string.format("%-6.6s %s", shorten_lhs(p.lhs), p.desc) + local bind_string = string.format("%-5s %s", p.lhs, p.desc) + local hl_len = math.max(5, string.len(p.lhs)) table.insert(help_lines, bind_string) - table.insert(help_hl, { "NvimTreeFolderName", num, 0, 6 }) + table.insert(help_hl, { "NvimTreeFolderName", num, 0, hl_len }) - table.insert(help_hl, { "NvimTreeFileRenamed", num, 6, -1 }) + table.insert(help_hl, { "NvimTreeFileRenamed", num, hl_len, -1 }) end return help_lines, help_hl end