21

Is there a function to convert between numbered and unordered lists in org-mode? The lists may or may not be nested.

bernie
  • 569
  • 3
  • 11

3 Answers3

32

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, or org-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 is previous, cycle backwards.

See the org manual node on plain lists for more details.

Dan
  • 32,584
  • 6
  • 98
  • 168
  • It isn't `C-c--` but `C-c -`. In words: Press and hold together the two buttons _Ctrl_ and _c_, release them and press the button `-` (minus). – buhtz Aug 17 '22 at 13:51
23

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.

Tyler
  • 21,719
  • 1
  • 52
  • 92
RUserPassingBy
  • 1,078
  • 7
  • 14
3

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)

hraban
  • 211
  • 1
  • 9
  • 2
    Both `C-c -` and `S-` do the same thing: they both end up calling the function `org-cycle-list-bullet`. `S-` calls `org-cycle-list-bullet` with an argument `previous`, something that cannot be done with `C-c -` (although that's not particularly inconvenient: the cycle is short). All of these are examples of `context-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. – NickD Apr 09 '21 at 15:33