Previous: Using capture, Up: Capture [Contents][Index]
You can use templates for different types of capture items, and for different target locations. The easiest way to create such templates is through the customize interface.
Customize the variable org-capture-templates
.
Before we give the formal description of template definitions, let’s look at an example. Say you would like to use one template to create general TODO entries, and you want to put these entries under the heading ‘Tasks’ in your file ‘~/org/gtd.org’. Also, a date tree in the file ‘journal.org’ should capture journal entries. A possible configuration would look like:
(setq org-capture-templates '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks") "* TODO %?\n %i\n %a") ("j" "Journal" entry (file+datetree "~/org/journal.org") "* %?\nEntered on %U\n %i\n %a")))
If you then press t from the capture menu, Org will prepare the template for you like this:
* TODO [[file:LINK TO WHERE YOU INITIATED CAPTURE]]
During expansion of the template, ‘%a’ has been replaced by a link to the location from where you called the capture command. This can be extremely useful for deriving tasks from emails, for example. You fill in the task definition, press C-c C-c and Org returns you to the same place where you started the capture process.
To define special keys to capture to a particular template without going through the interactive template selection, you can create your key binding like this:
(define-key global-map (kbd "C-c x") (lambda () (interactive) (org-capture nil "x")))
• Template elements | What is needed for a complete template entry. | |
• Template expansion | Filling in information about time and context. | |
• Templates in contexts | Only show a template in a specific context. |
Previous: Using capture, Up: Capture [Contents][Index]