Skip to content

Commit 193c226

Browse files
committed
docs: document org_agenda_prefix_format
1 parent e26dcf3 commit 193c226

2 files changed

Lines changed: 103 additions & 0 deletions

File tree

doc/orgmode.txt

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,59 @@ Separator used to separate multiple agenda views generated by
845845
`@org.agenda.separator` hl group.
846846

847847

848+
org_agenda_prefix_format *orgmode-org_agenda_prefix_format*
849+
850+
- Type: `{ agenda?: string, todo?: string, tags?: string, search?: string,
851+
tags_todo?: string }`
852+
- Default:
853+
>lua
854+
{
855+
agenda = ' %-12:c%?t% s',
856+
todo = ' %-12:c',
857+
tags = ' %-12:c',
858+
tags_todo = ' %-12:c',
859+
search = ' %-12:c',
860+
}
861+
<
862+
863+
Format for the prefix of each line in the agenda view. The format string can
864+
contain placeholders that will be replaced with actual values. Format of the
865+
placeholder: `%[specifiers][variable]` or `%[specifiers](lua expression)`.
866+
867+
**Specifiers:**
868+
869+
- `-` - Left align the value (default is right align)
870+
- `[number]` - Set fixed width for the value
871+
- `?` - Optional placeholder. If the value is empty, the placeholder (and surrounding spaces) will be omitted.
872+
873+
**Variables:**
874+
875+
- `c` - Category of the headline
876+
- `:c` - Category of the headline followed by a colon
877+
- `s` - Planning info (Deadline, Scheduled, etc.)
878+
- `t` - Time range (e.g. 10:00-11:00)
879+
- `T` - Tags
880+
- `e` - Effort property
881+
- `l` - Headline level
882+
- `b` - Breadcrumbs (parent headline titles separated by `->`)
883+
884+
**Lua expressions:** Anything inside `%()` will be evaluated as a Lua
885+
expression. The expression has access to following variables:
886+
887+
- `headline` - |orgmode-orgheadline| object
888+
- `item` - |orgmode-orgagendaitem| object (only in `agenda` view)
889+
- `metadata` - Metadata table containing `category_length`
890+
891+
Example:
892+
893+
>lua
894+
org_agenda_prefix_format = {
895+
agenda = ' %-12:c %?t %s ',
896+
todo = ' %-12:c %(headline:get_property("PRIORITY") or "C") '
897+
}
898+
<
899+
900+
848901
org_agenda_remove_tags *orgmode-org_agenda_remove_tags*
849902

850903
- Type: `boolean`

docs/configuration.org

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,56 @@ Separator used to separate multiple agenda views generated by
788788
[[#org_agenda_custom_commands][org_agenda_custom_commands]].
789789
To change the highlight, override =@org.agenda.separator= hl group.
790790

791+
*** org_agenda_prefix_format
792+
:PROPERTIES:
793+
:CUSTOM_ID: org_agenda_prefix_format
794+
:END:
795+
- Type: ={ agenda?: string, todo?: string, tags?: string, search?: string, tags_todo?: string }=
796+
- Default:
797+
#+begin_src lua
798+
{
799+
agenda = ' %-12:c%?t% s',
800+
todo = ' %-12:c',
801+
tags = ' %-12:c',
802+
tags_todo = ' %-12:c',
803+
search = ' %-12:c',
804+
}
805+
#+end_src
806+
807+
Format for the prefix of each line in the agenda view.
808+
The format string can contain placeholders that will be replaced with actual values.
809+
Format of the placeholder: =%[specifiers][variable]= or =%[specifiers](lua expression)=.
810+
811+
*Specifiers:*
812+
- =-= - Left align the value (default is right align)
813+
- =[number]= - Set fixed width for the value
814+
- =?= - Optional placeholder. If the value is empty, the placeholder (and surrounding spaces) will be omitted.
815+
816+
*Variables:*
817+
- =c= - Category of the headline
818+
- =:c= - Category of the headline followed by a colon
819+
- =s= - Planning info (Deadline, Scheduled, etc.)
820+
- =t= - Time range (e.g. 10:00-11:00)
821+
- =T= - Tags
822+
- =e= - Effort property
823+
- =l= - Headline level
824+
- =b= - Breadcrumbs (parent headline titles separated by =->=)
825+
826+
*Lua expressions:*
827+
Anything inside =%()= will be evaluated as a Lua expression.
828+
The expression has access to following variables:
829+
- =headline= - [[#org-headline][OrgHeadline]] object
830+
- =item= - [[#org-agenda-item][OrgAgendaItem]] object (only in =agenda= view)
831+
- =metadata= - Metadata table containing =category_length=
832+
833+
Example:
834+
#+begin_src lua
835+
org_agenda_prefix_format = {
836+
agenda = ' %-12:c %?t %s ',
837+
todo = ' %-12:c %(headline:get_property("PRIORITY") or "C") '
838+
}
839+
#+end_src
840+
791841
*** org_agenda_remove_tags
792842
:PROPERTIES:
793843
:CUSTOM_ID: org_agenda_remove_tags

0 commit comments

Comments
 (0)