@@ -10,22 +10,14 @@ local function tidy_lhs(lhs)
10
10
end
11
11
12
12
-- uppercase ctrls
13
- if lhs :match " ^<C %-" then
13
+ if lhs :lower (): match " ^<c %-" then
14
14
lhs = lhs :upper ()
15
15
end
16
16
17
- return lhs
18
- end
17
+ -- space is not escaped
18
+ lhs = lhs : gsub ( " " , " <Space> " )
19
19
20
- local function shorten_lhs (lhs )
21
20
return lhs
22
- :gsub (" LeftMouse>$" , " LM>" )
23
- :gsub (" RightMouse>$" , " RM>" )
24
- :gsub (" MiddleMouse>$" , " MM>" )
25
- :gsub (" ScrollWheelDown>$" , " SD>" )
26
- :gsub (" ScrollWheelUp>$" , " SU>" )
27
- :gsub (" ScrollWheelLeft>$" , " SL>" )
28
- :gsub (" ScrollWheelRight>$" , " SR>" )
29
21
end
30
22
31
23
-- sort lhs roughly as per :help index
@@ -78,19 +70,16 @@ function M.compute_lines()
78
70
return sort_lhs (a .lhs , b .lhs )
79
71
end )
80
72
81
- for _ , p in pairs (lines ) do
82
- p .lhs = shorten_lhs (p .lhs )
83
- end
84
-
85
73
local num = 0
86
74
for _ , p in pairs (lines ) do
87
75
num = num + 1
88
- local bind_string = string.format (" %-6.6s %s" , shorten_lhs (p .lhs ), p .desc )
76
+ local bind_string = string.format (" %-5s %s" , p .lhs , p .desc )
77
+ local hl_len = math.max (5 , string.len (p .lhs ))
89
78
table.insert (help_lines , bind_string )
90
79
91
- table.insert (help_hl , { " NvimTreeFolderName" , num , 0 , 6 })
80
+ table.insert (help_hl , { " NvimTreeFolderName" , num , 0 , hl_len })
92
81
93
- table.insert (help_hl , { " NvimTreeFileRenamed" , num , 6 , - 1 })
82
+ table.insert (help_hl , { " NvimTreeFileRenamed" , num , hl_len , - 1 })
94
83
end
95
84
return help_lines , help_hl
96
85
end
0 commit comments