@@ -57,37 +57,41 @@ local helps = {
5757 { key = ' org_toggle_heading' , description = ' Toggle current line to headline and vice versa' },
5858 },
5959 orgagenda = {
60- { key = ' org_agenda_later' , description = ' Go forward one span' },
61- { key = ' org_agenda_earlier' , description = ' Go backward one span' },
62- { key = ' org_agenda_goto_today' , description = " Go to today's span" },
63- { key = ' org_agenda_goto_date' , description = ' Jump to specific date' },
64- { key = ' org_agenda_day_view' , description = ' Show day view' },
65- { key = ' org_agenda_week_view' , description = ' Show week view' },
66- { key = ' org_agenda_month_view' , description = ' Show month view' },
67- { key = ' org_agenda_year_view' , description = ' Show year view' },
68- { key = ' org_agenda_switch_to' , description = ' Open in current window' },
69- { key = ' org_agenda_goto' , description = ' Open in another window' },
70- { key = ' org_agenda_redo' , description = ' Reload org files and redraw' },
71- { key = ' org_agenda_todo' , description = ' Change TODO state of an item' },
72- { key = ' org_agenda_clock_in' , description = ' Clock in item under cursor' },
73- { key = ' org_agenda_clock_out' , description = ' Clock out currently active clocked item' },
74- { key = ' org_agenda_clock_cancel' , description = ' Cancel clocking on currently active clocked item' },
75- { key = ' org_agenda_clock_goto' , description = ' Jump to currently active clock item' },
76- { key = ' org_agenda_set_effort' , description = ' Set effort estimate for item under cursor' },
77- { key = ' org_agenda_clockreport_mode' , description = ' Toggle clock report for current agenda time range' },
78- {
79- key = ' org_agenda_filter' ,
80- description = ' Open prompt that allows filtering by category, tags and title(vim regex)' ,
60+ agenda_specific = {
61+ { key = ' org_agenda_later' , description = ' Go forward one span' },
62+ { key = ' org_agenda_earlier' , description = ' Go backward one span' },
63+ { key = ' org_agenda_goto_today' , description = " Go to today's span" },
64+ { key = ' org_agenda_goto_date' , description = ' Jump to specific date' },
65+ { key = ' org_agenda_day_view' , description = ' Show day view' },
66+ { key = ' org_agenda_week_view' , description = ' Show week view' },
67+ { key = ' org_agenda_month_view' , description = ' Show month view' },
68+ { key = ' org_agenda_year_view' , description = ' Show year view' },
69+ },
70+ generic = {
71+ { key = ' org_agenda_switch_to' , description = ' Open in current window' },
72+ { key = ' org_agenda_goto' , description = ' Open in another window' },
73+ { key = ' org_agenda_redo' , description = ' Reload org files and redraw' },
74+ { key = ' org_agenda_todo' , description = ' Change TODO state of an item' },
75+ { key = ' org_agenda_clock_in' , description = ' Clock in item under cursor' },
76+ { key = ' org_agenda_clock_out' , description = ' Clock out currently active clocked item' },
77+ { key = ' org_agenda_clock_cancel' , description = ' Cancel clocking on currently active clocked item' },
78+ { key = ' org_agenda_clock_goto' , description = ' Jump to currently active clock item' },
79+ { key = ' org_agenda_set_effort' , description = ' Set effort estimate for item under cursor' },
80+ { key = ' org_agenda_clockreport_mode' , description = ' Toggle clock report for current agenda time range' },
81+ {
82+ key = ' org_agenda_filter' ,
83+ description = ' Open prompt that allows filtering by category, tags and title(vim regex)' ,
84+ },
85+ { key = ' org_agenda_priority' , description = ' Set priority for current item' },
86+ { key = ' org_agenda_priority_up' , description = ' Increase priority for current item' },
87+ { key = ' org_agenda_priority_down' , description = ' Decrease priority for current item' },
88+ { key = ' org_agenda_toggle_archive_tag' , description = ' Toggle "ARCHIVE" tag on current headline' },
89+ { key = ' org_agenda_set_tags' , description = ' Change tags of current headline' },
90+ { key = ' org_agenda_deadline' , description = ' Insert/Update deadline date on current headline' },
91+ { key = ' org_agenda_schedule' , description = ' Insert/Update scheduled date on current headline' },
92+ { key = ' org_agenda_quit' , description = ' Close agenda' },
93+ { key = ' org_agenda_show_help' , description = ' Show this help' },
8194 },
82- { key = ' org_agenda_priority' , description = ' Set priority for current item' },
83- { key = ' org_agenda_priority_up' , description = ' Increase priority for current item' },
84- { key = ' org_agenda_priority_down' , description = ' Decrease priority for current item' },
85- { key = ' org_agenda_toggle_archive_tag' , description = ' Toggle "ARCHIVE" tag on current headline' },
86- { key = ' org_agenda_set_tags' , description = ' Change tags of current headline' },
87- { key = ' org_agenda_deadline' , description = ' Insert/Update deadline date on current headline' },
88- { key = ' org_agenda_schedule' , description = ' Insert/Update scheduled date on current headline' },
89- { key = ' org_agenda_quit' , description = ' Close agenda' },
90- { key = ' org_agenda_show_help' , description = ' Show this help' },
9195 },
9296 capture = {
9397 { key = ' org_capture_finalize' , description = ' Save to default notes file and close the window' },
@@ -165,7 +169,10 @@ function Help._prepare_orgcapture(mappings, max_height)
165169 maps = table.concat (maps , ' , ' )
166170 end
167171
168- table.insert (content , string.format (' `%-12s` - %s' , maps , item .description ))
172+ table.insert (
173+ content ,
174+ string.format (' `%-12s` - %s' , string.gsub (maps , ' <prefix>' , mappings .prefix ), item .description )
175+ )
169176 end
170177
171178 table.insert (content , ' __Org__' )
@@ -186,7 +193,10 @@ function Help._prepare_orgnote(mappings, max_height)
186193 maps = table.concat (maps , ' , ' )
187194 end
188195
189- table.insert (content , string.format (' `%-12s` - %s' , maps , item .description ))
196+ table.insert (
197+ content ,
198+ string.format (' `%-12s` - %s' , string.gsub (maps , ' <prefix>' , mappings .prefix ), item .description )
199+ )
190200 end
191201
192202 table.insert (content , ' __Org__' )
@@ -195,19 +205,34 @@ function Help._prepare_orgnote(mappings, max_height)
195205end
196206
197207function Help ._prepare_orgagenda (mappings , max_height )
208+ local agenda_mappings = vim .deepcopy (helps .orgagenda .generic )
209+ local height = # helps .orgagenda .generic
210+
211+ local agenda_type_text = ' '
212+ if vim .b .org_agenda_type == ' agenda' then
213+ agenda_mappings = utils .concat (vim .deepcopy (helps .orgagenda .agenda_specific ), agenda_mappings )
214+ height = height + # helps .orgagenda .agenda_specific
215+ else
216+ agenda_type_text = ' ' .. vim .b .org_agenda_type
217+ end
218+
198219 local scroll_more_text = ' '
199- if # helps . orgagenda > max_height then
220+ if height > max_height then
200221 scroll_more_text = ' (Scroll down for more)'
201222 end
202223
203- local content = { string.format (' **Orgmode mappings - Agenda%s:**' , scroll_more_text ), ' ' }
204- for _ , item in ipairs (helps .orgagenda ) do
224+ local content = { string.format (' **Orgmode mappings - Agenda%s%s:**' , agenda_type_text , scroll_more_text ), ' ' }
225+
226+ for _ , item in ipairs (agenda_mappings ) do
205227 local maps = mappings .agenda [item .key ]
206228 if type (maps ) == ' table' then
207229 maps = table.concat (maps , ' , ' )
208230 end
209231
210- table.insert (content , string.format (' `%-12s` - %s' , maps , item .description ))
232+ table.insert (
233+ content ,
234+ string.format (' `%-12s` - %s' , string.gsub (maps , ' <prefix>' , mappings .prefix ), item .description )
235+ )
211236 end
212237
213238 table.insert (content , ' ' )
@@ -230,7 +255,10 @@ function Help._prepare_edit_src(mappings, max_height)
230255 maps = table.concat (maps , ' , ' )
231256 end
232257
233- table.insert (content , string.format (' `%-12s` - %s' , maps , item .description ))
258+ table.insert (
259+ content ,
260+ string.format (' `%-12s` - %s' , string.gsub (maps , ' <prefix>' , mappings .prefix ), item .description )
261+ )
234262 end
235263
236264 return content , true
@@ -261,9 +289,14 @@ function Help.prepare_content(opts)
261289 maps = table.concat (maps , ' , ' )
262290 end
263291
264- table.insert (content , string.format (' `%-12s` - %s' , maps , item .description ))
292+ table.insert (
293+ content ,
294+ string.format (' `%-12s` - %s' , string.gsub (maps , ' <prefix>' , mappings .prefix ), item .description )
295+ )
265296 end
266297
298+ table.insert (content , ' __Text Objects__' )
299+
267300 for _ , item in ipairs (helps .text_objects ) do
268301 local maps = mappings .text_objects [item .key ]
269302 table.insert (content , string.format (' `%-12s` - %s' , maps , item .description ))
0 commit comments