Skip to content

Commit 95d765b

Browse files
author
milanglacier
authored
doc: update org-capture %() evaluating lua expression instruction (#446)
1 parent b9ae1f1 commit 95d765b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

DOCS.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ Variables:
369369
* `%x`: Insert content of the clipboard via the "+" register (see :help clipboard)
370370
* `%?`: Default cursor position when template is opened
371371
* `%^{PROMPT|DEFAULT|COMPLETION...}`: Prompt for input, if completion is provided an :h inputlist will be used
372-
* `%(EXP)`: Runs the given lua code and inserts the result
372+
* `%(EXP)`: Runs the given lua code and inserts the result. NOTE: this will internally pass the content to the lua `load()` function. So the body inside `%()` should be the body of a function that returns a string.
373373

374374
Example:<br />
375375
```lua
@@ -408,6 +408,16 @@ Nested key example:<br />
408408
}
409409
```
410410

411+
Lua expression example:<br />
412+
```lua
413+
{ j = {
414+
description = 'Journal',
415+
template = '* %(return vim.fn.getreg "w")',
416+
-- get the content of register "w"
417+
target = '~/sync/org/journal.org'
418+
} }
419+
```
420+
411421
#### **org_agenda_min_height**
412422
*type*: `number`<br />
413423
*default value*: `16`<br />

0 commit comments

Comments
 (0)