Skip to content

Commit 07d0e00

Browse files
authored
Which-key descriptions (#352)
1 parent 3186ac3 commit 07d0e00

File tree

2 files changed

+133
-84
lines changed

2 files changed

+133
-84
lines changed

lua/orgmode/config/defaults.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ return {
116116
org_do_demote = '>>',
117117
org_promote_subtree = '<s',
118118
org_demote_subtree = '>s',
119-
org_meta_return = '<Leader><CR>', -- Add headling, item or row
119+
org_meta_return = '<Leader><CR>', -- Add heading, item or row
120120
org_return = '<CR>',
121121
org_insert_heading_respect_content = '<Leader>oih', -- Add new headling after current heading block with same level
122122
org_insert_todo_heading = '<Leader>oiT', -- Add new todo headling right after current heading with same level

lua/orgmode/config/mappings/init.lua

Lines changed: 132 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -2,100 +2,149 @@ local m = require('orgmode.config.mappings.map_entry')
22

33
return {
44
global = {
5-
org_agenda = m.action('agenda.prompt', { opts = { buffer = false } }),
6-
org_capture = m.action('capture.prompt', { opts = { buffer = false } }),
5+
org_agenda = m.action('agenda.prompt', { opts = { buffer = false, desc = 'org agenda' } }),
6+
org_capture = m.action('capture.prompt', { opts = { buffer = false, desc = 'org capture' } }),
77
},
88
agenda = {
9-
org_agenda_later = m.action('agenda.advance_span', { args = { 1 } }),
10-
org_agenda_earlier = m.action('agenda.advance_span', { args = { -1 } }),
11-
org_agenda_goto_today = m.action('agenda.reset'),
12-
org_agenda_day_view = m.action('agenda.change_span', { args = { 'day' } }),
13-
org_agenda_week_view = m.action('agenda.change_span', { args = { 'week' } }),
14-
org_agenda_month_view = m.action('agenda.change_span', { args = { 'month' } }),
15-
org_agenda_year_view = m.action('agenda.change_span', { args = { 'year' } }),
16-
org_agenda_quit = m.action('agenda.quit'),
17-
org_agenda_switch_to = m.action('agenda.switch_to_item'),
18-
org_agenda_goto = m.action('agenda.goto_item'),
19-
org_agenda_goto_date = m.action('agenda.goto_date'),
20-
org_agenda_redo = m.action('agenda.redo'),
21-
org_agenda_todo = m.action('agenda.change_todo_state'),
22-
org_agenda_clock_in = m.action('agenda.clock_in'),
23-
org_agenda_clock_out = m.action('agenda.clock_out'),
24-
org_agenda_clock_cancel = m.action('agenda.clock_cancel'),
25-
org_agenda_set_effort = m.action('agenda.set_effort'),
26-
org_agenda_clock_goto = m.action('clock.org_clock_goto'),
27-
org_agenda_clockreport_mode = m.action('agenda.toggle_clock_report'),
28-
org_agenda_priority = m.action('agenda.set_priority'),
29-
org_agenda_priority_up = m.action('agenda.priority_up'),
30-
org_agenda_priority_down = m.action('agenda.priority_down'),
31-
org_agenda_toggle_archive_tag = m.action('agenda.toggle_archive_tag'),
32-
org_agenda_set_tags = m.action('agenda.set_tags'),
33-
org_agenda_deadline = m.action('agenda.set_deadline'),
34-
org_agenda_schedule = m.action('agenda.set_schedule'),
35-
org_agenda_filter = m.action('agenda.filter'),
36-
org_agenda_show_help = m.action('org_mappings.show_help'),
9+
org_agenda_later = m.action('agenda.advance_span', { args = { 1 }, opts = { desc = 'org next agenda span' } }),
10+
org_agenda_earlier = m.action('agenda.advance_span', { args = { -1 }, opts = { desc = 'org prev agenda span' } }),
11+
org_agenda_goto_today = m.action('agenda.reset', { opts = { desc = 'org goto today' } }),
12+
org_agenda_day_view = m.action('agenda.change_span', { args = { 'day' }, opts = { desc = 'org day view' } }),
13+
org_agenda_week_view = m.action('agenda.change_span', { args = { 'week' }, opts = { desc = 'org week view' } }),
14+
org_agenda_month_view = m.action('agenda.change_span', { args = { 'month' }, opts = { desc = 'org month view' } }),
15+
org_agenda_year_view = m.action('agenda.change_span', { args = { 'year' }, opts = { desc = 'org year view' } }),
16+
org_agenda_quit = m.action('agenda.quit', { opts = { desc = 'org close agenda' } }),
17+
org_agenda_switch_to = m.action(
18+
'agenda.switch_to_item',
19+
{ opts = { desc = 'org open agenda item (same buffer)' } }
20+
),
21+
org_agenda_goto = m.action('agenda.goto_item', { opts = { desc = 'org open agenda item (split buffer)' } }),
22+
org_agenda_goto_date = m.action('agenda.goto_date', { opts = { desc = 'org goto date' } }),
23+
org_agenda_redo = m.action('agenda.redo', { opts = { desc = 'org redo' } }),
24+
org_agenda_todo = m.action('agenda.change_todo_state', { opts = { desc = 'org cycle todo state' } }),
25+
org_agenda_clock_in = m.action('agenda.clock_in', { opts = { desc = 'org clock in' } }),
26+
org_agenda_clock_out = m.action('agenda.clock_out', { opts = { desc = 'org clock out' } }),
27+
org_agenda_clock_cancel = m.action('agenda.clock_cancel', { opts = { desc = 'org clock cancel' } }),
28+
org_agenda_set_effort = m.action('agenda.set_effort', { opts = { desc = 'org set effort' } }),
29+
org_agenda_clock_goto = m.action('clock.org_clock_goto', { opts = { desc = 'org goto active clock item' } }),
30+
org_agenda_clockreport_mode = m.action('agenda.toggle_clock_report', { opts = { desc = 'org clockreport mode' } }),
31+
org_agenda_priority = m.action('agenda.set_priority', { opts = { desc = 'org set priority' } }),
32+
org_agenda_priority_up = m.action('agenda.priority_up', { opts = { desc = 'org increase priority' } }),
33+
org_agenda_priority_down = m.action('agenda.priority_down', { opts = { desc = 'org decrease priority' } }),
34+
org_agenda_toggle_archive_tag = m.action(
35+
'agenda.toggle_archive_tag',
36+
{ opts = { desc = 'org toggle archive tag' } }
37+
),
38+
org_agenda_set_tags = m.action('agenda.set_tags', { opts = { desc = 'org set tags' } }),
39+
org_agenda_deadline = m.action('agenda.set_deadline', { opts = { desc = 'org deadline' } }),
40+
org_agenda_schedule = m.action('agenda.set_schedule', { opts = { desc = 'org schedule' } }),
41+
org_agenda_filter = m.action('agenda.filter', { opts = { desc = 'org filter' } }),
42+
org_agenda_show_help = m.action('org_mappings.show_help', { opts = { desc = 'org show help' } }),
3743
},
3844
capture = {
39-
org_capture_finalize = m.action('capture.refile'),
40-
org_capture_refile = m.action('capture.refile_to_destination'),
41-
org_capture_kill = m.action('capture.kill'),
42-
org_capture_show_help = m.action('org_mappings.show_help'),
45+
org_capture_finalize = m.action('capture.refile', { opts = { desc = 'org finalize' } }),
46+
org_capture_refile = m.action('capture.refile_to_destination', { opts = { desc = 'org refile' } }),
47+
org_capture_kill = m.action('capture.kill', { opts = { desc = 'org kill' } }),
48+
org_capture_show_help = m.action('org_mappings.show_help', { opts = { desc = 'org show help' } }),
4349
},
4450
org = {
45-
org_refile = m.action('capture.refile_headline_to_destination'),
46-
org_timestamp_up_day = m.action('org_mappings.timestamp_up_day'),
47-
org_timestamp_down_day = m.action('org_mappings.timestamp_down_day'),
48-
org_timestamp_up = m.action('org_mappings.timestamp_up'),
49-
org_timestamp_down = m.action('org_mappings.timestamp_down'),
50-
org_change_date = m.action('org_mappings.change_date'),
51-
org_todo = m.action('org_mappings.todo_next_state'),
52-
org_priority = m.action('org_mappings.set_priority'),
53-
org_priority_up = m.action('org_mappings.priority_up'),
54-
org_priority_down = m.action('org_mappings.priority_down'),
55-
org_todo_prev = m.action('org_mappings.todo_prev_state'),
56-
org_toggle_checkbox = m.action('org_mappings.toggle_checkbox'),
57-
org_toggle_heading = m.action('org_mappings.toggle_heading'),
58-
org_open_at_point = m.action('org_mappings.open_at_point'),
59-
org_edit_special = m.action('org_mappings.edit_special'),
60-
org_cycle = m.action('org_mappings.cycle'),
61-
org_global_cycle = m.action('org_mappings.global_cycle'),
62-
org_archive_subtree = m.action('org_mappings.archive'),
63-
org_set_tags_command = m.action('org_mappings.set_tags'),
64-
org_toggle_archive_tag = m.action('org_mappings.toggle_archive_tag'),
65-
org_do_promote = m.action('org_mappings.do_promote'),
66-
org_do_demote = m.action('org_mappings.do_demote'),
67-
org_promote_subtree = m.action('org_mappings.do_promote', { args = { true } }),
68-
org_demote_subtree = m.action('org_mappings.do_demote', { args = { true } }),
69-
org_meta_return = m.action('org_mappings.handle_return'),
70-
org_insert_heading_respect_content = m.action('org_mappings.insert_heading_respect_content'),
71-
org_insert_todo_heading = m.action('org_mappings.insert_todo_heading'),
72-
org_insert_todo_heading_respect_content = m.action('org_mappings.insert_todo_heading_respect_content'),
73-
org_move_subtree_up = m.action('org_mappings.move_subtree_up'),
74-
org_move_subtree_down = m.action('org_mappings.move_subtree_down'),
75-
org_export = m.action('org_mappings.export'),
76-
org_return = m.action('org_mappings.org_return', { modes = { 'i' } }),
51+
org_refile = m.action('capture.refile_headline_to_destination', { opts = { desc = 'org refile' } }),
52+
org_timestamp_up_day = m.action(
53+
'org_mappings.timestamp_up_day',
54+
{ opts = { desc = 'org increase timestamp (day)' } }
55+
),
56+
org_timestamp_down_day = m.action(
57+
'org_mappings.timestamp_down_day',
58+
{ opts = { desc = 'org decrease timestamp (day)' } }
59+
),
60+
org_timestamp_up = m.action('org_mappings.timestamp_up', { opts = { desc = 'org increase timestamp' } }),
61+
org_timestamp_down = m.action('org_mappings.timestamp_down', { opts = { desc = 'org decrease timestamp' } }),
62+
org_change_date = m.action('org_mappings.change_date', { opts = { desc = 'org change date' } }),
63+
org_todo = m.action('org_mappings.todo_next_state', { opts = { desc = 'org next todo state' } }),
64+
org_todo_prev = m.action('org_mappings.todo_prev_state', { opts = { desc = 'org prev todo state' } }),
65+
org_priority = m.action('org_mappings.set_priority', { opts = { desc = 'org cycle priority' } }),
66+
org_priority_up = m.action('org_mappings.priority_up', { opts = { desc = 'org increase priority' } }),
67+
org_priority_down = m.action('org_mappings.priority_down', { opts = { desc = 'org decrease priority' } }),
68+
org_toggle_checkbox = m.action('org_mappings.toggle_checkbox', { opts = { desc = 'org toggle checkbox' } }),
69+
org_toggle_heading = m.action('org_mappings.toggle_heading', { opts = { desc = 'org toggle headline' } }),
70+
org_open_at_point = m.action('org_mappings.open_at_point', { opts = { desc = 'org open' } }),
71+
org_edit_special = m.action('org_mappings.edit_special', { opts = { desc = 'org edit special' } }),
72+
org_cycle = m.action('org_mappings.cycle', { opts = { desc = 'org toggle fold' } }),
73+
org_global_cycle = m.action('org_mappings.global_cycle', { opts = { desc = 'org toggle fold (whole file)' } }),
74+
org_archive_subtree = m.action('org_mappings.archive', { opts = { desc = 'org archive subtree' } }),
75+
org_set_tags_command = m.action('org_mappings.set_tags', { opts = { desc = 'org set tags' } }),
76+
org_toggle_archive_tag = m.action(
77+
'org_mappings.toggle_archive_tag',
78+
{ opts = { desc = 'org toggle archive tag' } }
79+
),
80+
org_do_promote = m.action('org_mappings.do_promote', { opts = { desc = 'org promote headline' } }),
81+
org_do_demote = m.action('org_mappings.do_demote', { opts = { desc = 'org demote headline' } }),
82+
org_promote_subtree = m.action(
83+
'org_mappings.do_promote',
84+
{ args = { true }, opts = { desc = 'org promote subtree' } }
85+
),
86+
org_demote_subtree = m.action(
87+
'org_mappings.do_demote',
88+
{ args = { true }, opts = { desc = 'org demote subtree' } }
89+
),
90+
org_meta_return = m.action('org_mappings.handle_return', { opts = { desc = 'org meta return' } }),
91+
org_insert_heading_respect_content = m.action(
92+
'org_mappings.insert_heading_respect_content',
93+
{ opts = { desc = 'org insert headline (respect content)' } }
94+
),
95+
org_insert_todo_heading = m.action('org_mappings.insert_todo_heading', { opts = { desc = 'org insert todo' } }),
96+
org_insert_todo_heading_respect_content = m.action(
97+
'org_mappings.insert_todo_heading_respect_content',
98+
{ opts = { desc = 'org insert todo (respect content)' } }
99+
),
100+
org_move_subtree_up = m.action('org_mappings.move_subtree_up', { opts = { desc = 'org move subtree up' } }),
101+
org_move_subtree_down = m.action('org_mappings.move_subtree_down', { opts = { desc = 'org move subtree down' } }),
102+
org_export = m.action('org_mappings.export', { opts = { desc = 'org export' } }),
103+
org_return = m.action('org_mappings.org_return', { modes = { 'i' }, opts = { desc = 'org return' } }),
77104
org_next_visible_heading = m.action('org_mappings.next_visible_heading', {
78105
modes = { 'n', 'x' },
106+
opts = { desc = 'org next visible headline' },
79107
}),
80-
org_previous_visible_heading = m.action('org_mappings.previous_visible_heading', { modes = { 'n', 'x' } }),
81-
org_forward_heading_same_level = m.action('org_mappings.forward_heading_same_level'),
82-
org_backward_heading_same_level = m.action('org_mappings.backward_heading_same_level'),
83-
outline_up_heading = m.action('org_mappings.outline_up_heading'),
84-
org_deadline = m.action('org_mappings.org_deadline'),
85-
org_schedule = m.action('org_mappings.org_schedule'),
86-
org_time_stamp = m.action('org_mappings.org_time_stamp'),
87-
org_time_stamp_inactive = m.action('org_mappings.org_time_stamp', { args = { true } }),
88-
org_clock_in = m.action('clock.org_clock_in'),
89-
org_clock_out = m.action('clock.org_clock_out'),
90-
org_clock_cancel = m.action('clock.org_clock_cancel'),
91-
org_clock_goto = m.action('clock.org_clock_goto'),
92-
org_set_effort = m.action('clock.org_set_effort'),
93-
org_show_help = m.action('org_mappings.show_help'),
108+
org_previous_visible_heading = m.action(
109+
'org_mappings.previous_visible_heading',
110+
{ modes = { 'n', 'x' }, opts = { desc = 'org prev visible headline' } }
111+
),
112+
org_forward_heading_same_level = m.action(
113+
'org_mappings.forward_heading_same_level',
114+
{ opts = { desc = 'org next headline (same level)' } }
115+
),
116+
org_backward_heading_same_level = m.action(
117+
'org_mappings.backward_heading_same_level',
118+
{ opts = { desc = 'org prev headline (same level)' } }
119+
),
120+
outline_up_heading = m.action('org_mappings.outline_up_heading', { opts = { desc = 'org goto parent headline' } }),
121+
org_deadline = m.action('org_mappings.org_deadline', { opts = { desc = 'org deadline' } }),
122+
org_schedule = m.action('org_mappings.org_schedule', { opts = { desc = 'org schedule' } }),
123+
org_time_stamp = m.action('org_mappings.org_time_stamp', { opts = { desc = 'org timestamp' } }),
124+
org_time_stamp_inactive = m.action(
125+
'org_mappings.org_time_stamp',
126+
{ args = { true }, opts = { desc = 'org timestamp (inactive)' } }
127+
),
128+
org_clock_in = m.action('clock.org_clock_in', { opts = { desc = 'org clock in' } }),
129+
org_clock_out = m.action('clock.org_clock_out', { opts = { desc = 'org clock out' } }),
130+
org_clock_cancel = m.action('clock.org_clock_cancel', { opts = { desc = 'org clock cancel' } }),
131+
org_clock_goto = m.action('clock.org_clock_goto', { opts = { desc = 'org clock goto' } }),
132+
org_set_effort = m.action('clock.org_set_effort', { opts = { desc = 'org set effort' } }),
133+
org_show_help = m.action('org_mappings.show_help', { opts = { desc = 'org show help' } }),
94134
},
95135
edit_src = {
96-
org_edit_src_abort = m.custom([[<Cmd>lua require('orgmode.objects.edit_special').abort()<CR>]]),
97-
org_edit_src_show_help = m.custom([[<Cmd>lua require('orgmode.objects.help').show({ type = 'edit_src' })<CR>]]),
98-
org_edit_src_save = m.custom([[<Cmd>lua require('orgmode.objects.edit_special'):new():write()<CR>]]),
136+
org_edit_src_abort = m.custom(
137+
[[<Cmd>lua require('orgmode.objects.edit_special').abort()<CR>]],
138+
{ opts = { desc = 'org abort' } }
139+
),
140+
org_edit_src_show_help = m.custom(
141+
[[<Cmd>lua require('orgmode.objects.help').show({ type = 'edit_src' })<CR>]],
142+
{ opts = { desc = 'org show help' } }
143+
),
144+
org_edit_src_save = m.custom(
145+
[[<Cmd>lua require('orgmode.objects.edit_special'):new():write()<CR>]],
146+
{ opts = { desc = 'org save' } }
147+
),
99148
},
100149
text_objects = {
101150
inner_heading = m.text_object('inner_heading'),

0 commit comments

Comments
 (0)