Block templates in org-mode

TL;DR Easy Templates

Anyone would agree that typing #+BEGIN_SRC ... #+END_SRC blocks manually feels strange.

In order to make life easier, some people implement helpers to insert these blocks. For example, Chris Done has org-begin-template function in his configs. Other people use yatemplate to create generic or specific templates for blocks.

But what is most fascinating, is that org-mode bundles with templates for some structural elements like these blocks. And instead of copy-pasting solutions into your .emacs file, take a look at Easy Templates.

With this feature you type < followed by template selector, then hit TAB and voilà. For source blocks it’s just <s<TAB>.

Just for reference, here is a list of available templates and their corresponding selectors. Please note that this table might become out of date, so it’s better to refer to official documentation.

Key Template
s #+BEGIN_SRC ... #+END_SRC
e #+BEGIN_EXAMPLE ... #+END_EXAMPLE
q #+BEGIN_QUOTE ... #+END_QUOTE
v #+BEGIN_VERSE ... #+END_VERSE
c #+BEGIN_CENTER ... #+END_CENTER
l #+BEGIN_LaTeX ... #+END_LaTeX
L #+LaTeX:
h #+BEGIN_HTML ... #+END_HTML
H #+HTML:
a #+BEGIN_ASCII ... #+END_ASCII
A #+ASCII:
i #+INDEX: line
I #+INCLUDE: line

Posted on July 30, 2017 by Boris Buliga

Source: Block templates in org-mode