Skip to content

Commit 68179a5

Browse files
Add docs for formatting
1 parent 9cfc537 commit 68179a5

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

DOCS.md

+18-5
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@
1818
6. [Hyperlinks](#hyperlinks)
1919
7. [Autocompletion](#autocompletion)
2020
8. [Abbreviations](#abbreviations)
21-
9. [Colors](#colors)
22-
10. [Advanced search](#advanced-search)
23-
11. [Notifications (experimental)](#notifications-experimental)
24-
12. [Clocking](#clocking)
25-
13. [Changelog](#changelog)
21+
9. [Formatting](#formatting)
22+
10. [Colors](#colors)
23+
11. [Advanced search](#advanced-search)
24+
12. [Notifications (experimental)](#notifications-experimental)
25+
13. [Clocking](#clocking)
26+
14. [Changelog](#changelog)
2627

2728
## Getting started with Orgmode
2829
To get a basic idea how Orgmode works, look at this screencast from [@dhruvasagar](https://github.com/dhruvasagar)
@@ -1045,6 +1046,18 @@ Some content [[|
10451046
* `:today:` - expands to today's date (example: `<2021-06-29 Tue>`)
10461047
* `:now:` - expands to today's date and current time (example: `<2021-06-29 Tue 15:32>`)
10471048

1049+
## Formatting
1050+
Formatting is done via `gq` mapping, which uses `formatexpr` under the hood (see `:help formatexpr` for more info).
1051+
For example, to re-format whole document, you can do `gggqG`. `gg` goes to first line in current file, `gq` starts the format motion,
1052+
and `G` goes to last line in file to make it format the whole thing. To format a single line, do `gqgq`, or to format selection,
1053+
select the lines you want to format and just do `gq`.
1054+
1055+
Currently, these things are formatted:
1056+
1057+
* Tags are aligned according to the `org_tags_column` setting
1058+
* Tables are formatted (see [Tables](#Tables) for more info)
1059+
* Clock entries total time is recalculated (see [Recalculating totals](#recalculating-totals) in [Clocking](#Clocking) section)
1060+
10481061
## Colors
10491062
Colors used for todo keywords and agenda states (deadline, schedule ok, schedule warning)
10501063
are parsed from the current colorsheme from several highlight groups (Error, WarningMsg, DiffAdd, etc.).

0 commit comments

Comments
 (0)