Is there a function to convert between numbered and unordered lists in org-mode? The lists may or may not be nested.
3 Answers
You can use the function org-ctrl-c-minus
, bound by default to
(you guessed it) Control-c--, to cycle through the bullet types. The doctstring reads:
Insert separator line in table or modify bullet status of line. Also turns a plain line or a region of lines into list items. Calls
org-table-insert-hline
,org-toggle-item
, ororg-cycle-list-bullet
, depending on context.
org-cycle-list-bullet
, in turn, does the following according to
the docstring:
(org-cycle-list-bullet &optional WHICH)
Cycle through the different itemize/enumerate bullets. This cycle the entire list level through the sequence:
-
->+
->*
->1.
->1)
If WHICH is a valid string, use that as the new bullet. If WHICH is an integer, 0 means
-
, 1 means+
etc. If WHICH isprevious
, cycle backwards.
See the
org
manual node on plain lists
for more details.
-
It isn't
C-c--
butC-c -
. In words: Press and hold together the two buttons Ctrl and c, release them and press the button-
(minus).– buhtzAug 17, 2022 at 13:51
In my org-mode environment, for example, the first state is as followings: unordered list.
- a
- b
- c
Modify the first line as "1. a" as numbered list.
1. a
- b
- c
Now, hit C-c C-c
at the first line "1. a".
Unordered list becomes numbered list.
1. a
2. b
3. c
Modify the first line as "- a" as unordered list.
- a
2. b
3. c
Now Hit C-c C-c
at the first line "- a".
Numbered list becomes unordered list.
- a
- b
- c
I hope it works.
-
1
You can use shift→
(that is S-<right>
in Emacs notation.) This is bound to org-shiftright
, which will automatically do the right thing for your entire list if you're on any of the items. Press it multiple times to cycle through all possible list styles. And S-<left>
goes the other way :)
(Source: reddit)
-
2Both
C-c -
andS-<right>
do the same thing: they both end up calling the functionorg-cycle-list-bullet
.S-<left>
callsorg-cycle-list-bullet
with an argumentprevious
, something that cannot be done withC-c -
(although that's not particularly inconvenient: the cycle is short). All of these are examples ofcontext-dependent
keybindings: they operate differently depending on the context. In particular, the description above applies when you use them on a list item. Consult the doc string of each function (e.g.C-h f org-shiftright
) for details.– NickDApr 9, 2021 at 15:33