@@ -57,37 +57,41 @@ local helps = {
57
57
{ key = ' org_toggle_heading' , description = ' Toggle current line to headline and vice versa' },
58
58
},
59
59
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' },
81
94
},
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' },
91
95
},
92
96
capture = {
93
97
{ 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)
165
169
maps = table.concat (maps , ' , ' )
166
170
end
167
171
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
+ )
169
176
end
170
177
171
178
table.insert (content , ' __Org__' )
@@ -186,7 +193,10 @@ function Help._prepare_orgnote(mappings, max_height)
186
193
maps = table.concat (maps , ' , ' )
187
194
end
188
195
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
+ )
190
200
end
191
201
192
202
table.insert (content , ' __Org__' )
@@ -195,19 +205,34 @@ function Help._prepare_orgnote(mappings, max_height)
195
205
end
196
206
197
207
function 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
+
198
219
local scroll_more_text = ' '
199
- if # helps . orgagenda > max_height then
220
+ if height > max_height then
200
221
scroll_more_text = ' (Scroll down for more)'
201
222
end
202
223
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
205
227
local maps = mappings .agenda [item .key ]
206
228
if type (maps ) == ' table' then
207
229
maps = table.concat (maps , ' , ' )
208
230
end
209
231
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
+ )
211
236
end
212
237
213
238
table.insert (content , ' ' )
@@ -230,7 +255,10 @@ function Help._prepare_edit_src(mappings, max_height)
230
255
maps = table.concat (maps , ' , ' )
231
256
end
232
257
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
+ )
234
262
end
235
263
236
264
return content , true
@@ -261,9 +289,14 @@ function Help.prepare_content(opts)
261
289
maps = table.concat (maps , ' , ' )
262
290
end
263
291
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
+ )
265
296
end
266
297
298
+ table.insert (content , ' __Text Objects__' )
299
+
267
300
for _ , item in ipairs (helps .text_objects ) do
268
301
local maps = mappings .text_objects [item .key ]
269
302
table.insert (content , string.format (' `%-12s` - %s' , maps , item .description ))
0 commit comments