20207 . [ Autocompletion] ( #autocompletion )
21218 . [ Abbreviations] ( #abbreviations )
22229 . [ Formatting] ( #formatting )
23- 10 . [ Colors] ( #colors )
23+ 10 . [ User interface] ( #user-interface )
24+ 1 . [ Colors] ( #colors )
25+ 2 . [ Menu] ( #menu )
242611 . [ Advanced search] ( #advanced-search )
252712 . [ Notifications (experimental)] ( #notifications-experimental )
262813 . [ Clocking] ( #clocking )
@@ -745,7 +747,7 @@ require('orgmode').setup({
745747})
746748```
747749
748- ### Closing note mappings
750+ ### Note mappings
749751
750752Mappings used in closing note window.
751753
@@ -1135,7 +1137,9 @@ Currently, these things are formatted:
11351137* Tables are formatted (see [ Tables] ( #Tables ) for more info)
11361138* Clock entries total time is recalculated (see [ Recalculating totals] ( #recalculating-totals ) in [ Clocking] ( #Clocking ) section)
11371139
1138- ## Colors
1140+ ## User interface
1141+
1142+ ### Colors
11391143Colors used for todo keywords and agenda states (deadline, schedule ok, schedule warning)
11401144are parsed from the current colorsheme from several highlight groups (Error, WarningMsg, DiffAdd, etc.).
11411145If those colors are not suitable you can override them like this:
@@ -1162,7 +1166,7 @@ endfunction
11621166
11631167For adding/changing TODO keyword colors see [ org-todo-keyword-faces] ( #org_todo_keyword_faces )
11641168
1165- ### Highlight Groups
1169+ #### Highlight Groups
11661170
11671171* The following highlight groups are based on _ Treesitter_ query results, hence when setting up _ Orgmode_ these
11681172 highlights must be enabled by removing ` disable = {'org'} ` from the default recommended _ Treesitter_ configuration.
@@ -1197,6 +1201,76 @@ For adding/changing TODO keyword colors see [org-todo-keyword-faces](#org_todo_k
11971201 * ` OrgAgendaScheduled ` : A scheduled item in the agenda view
11981202 * ` OrgAgendaScheduledPast ` : A item past its scheduled date in the agenda view
11991203
1204+ ### Menu
1205+
1206+ The menu is used when selecting further actions in ` agenda ` , ` capture ` and ` export ` . Here is an example of the menu you see when opening ` agenda ` :
1207+
1208+ ```
1209+ Press key for an agenda command
1210+ -------------------------------
1211+ a Agenda for current week or day
1212+ t List of all TODO entries
1213+ m Match a TAGS/PROP/TODO query
1214+ M Like m, but only for TODO entries
1215+ s Search for keywords
1216+ q Quit
1217+ ```
1218+ Users have the option to change the appearance of this menu. To do this, you need to add a handler in the UI configuration section:
1219+ ``` lua
1220+ require (" orgmode" ).setup ({
1221+ ui = {
1222+ menu = {
1223+ handler = function (data )
1224+ -- your handler here, for example:
1225+ local options = {}
1226+ local options_by_label = {}
1227+
1228+ for _ , item in ipairs (data .items ) do
1229+ -- Only MenuOption has `key`
1230+ -- Also we don't need `Quit` option because we can close the menu with ESC
1231+ if item .key and item .label :lower () ~= " quit" then
1232+ table.insert (options , item .label )
1233+ options_by_label [item .label ] = item
1234+ end
1235+ end
1236+
1237+ local handler = function (choice )
1238+ if not choice then
1239+ return
1240+ end
1241+
1242+ local option = options_by_label [choice ]
1243+ if option .action then
1244+ option .action ()
1245+ end
1246+ end
1247+
1248+ vim .ui .select (options , {
1249+ propmt = data .propmt ,
1250+ }, handler )
1251+ end ,
1252+ },
1253+ },
1254+ })
1255+ ```
1256+ When the menu is called, the handler receives a table ` data ` with the following fields as input:
1257+ * ` title ` (` string ` ) — menu title
1258+ * ` items ` (` table ` ) — array containing ` MenuItem ` (see below)
1259+ * ` prompt ` (` string ` ) — prompt text used to prompt a keystroke
1260+
1261+ Each menu item ` MenuItem ` is one of two types: ` MenuOption ` and ` MenuSeparator ` .
1262+
1263+ ` MenuOption ` is a table containing the following fields:
1264+ * ` label ` (` string ` ) — description of the action
1265+ * ` key ` (` string ` ) — key that will be processed when the keys are pressed in the menu
1266+ * ` action ` (` function ` * optional* ) — handler that will be called when the ` key ` is pressed in the menu.
1267+
1268+ ` MenuSeparator ` is a table containing the following fields:
1269+ * ` icon ` (` string ` * optional* ) — character used as separator. The default character is ` - `
1270+ * ` length ` (` number ` * optional* ) — number of repetitions of the separator character. The default length is 80
1271+
1272+ In order for the menu to work as expected, the handler must call ` action ` from ` MenuItem ` .
1273+
12001274## Advanced search
12011275Part of [ Advanced search] ( https://orgmode.org/worg/org-tutorials/advanced-searching.html ) functionality
12021276is implemented.
0 commit comments