This post is from a low-reputation account and contains an unverified outbound link. Be cautious before clicking external links.

Indenting code blocks in Spacemacs org-mode

Words
97
Reading
1 min
Listen
Play
8y

Org-mode (along with org-reveal) is an simple and easy to use method for creating documents and presentations in Spacemacs.

However, the default formatting for the code blocks isn't great. Here's how one can format code block:

  • In org-mode, enter the code block (designated by #+BEGIN_SRC and #+END_SRC blocks) and type

C-c '

to open a new buffer with the source code in the block

  • Type

M-m j =

to indent the whole buffer

  • Type

, c

in the code block buffer to return the org-mode document (which also copies the indented code back.

Links:

Indenting code blocks in Spacemacs org-mode | Ecency