# Combine list plugins

> Install bullet, ordered, and task lists together.

## Install

```sh
cargo add gpdoc-plugin-bullet-list gpdoc-plugin-ordered-list gpdoc-plugin-list-item
cargo add gpdoc-plugin-task-list gpdoc-plugin-list-keymap
```

## Try it

Bullet and ordered lists share `list_item()`. Checklists use `task_item()`. Register both item types with `paragraph()` and add `list_keymap()` for keyboard shortcuts at list boundaries.

[Try the lists editor example](https://gpdoc.dev/docs/lists/#lists-example)

## Example

In a [Quickstart project](/docs/quickstart/), create a checklist from a typed marker.

```rust
use gpdoc::{Editor, EditorConfig, Node};
use gpdoc_plugin_bullet_list::bullet_list;
use gpdoc_plugin_list_item::list_item;
use gpdoc_plugin_list_keymap::list_keymap;
use gpdoc_plugin_ordered_list::ordered_list;
use gpdoc_plugin_paragraph::paragraph;
use gpdoc_plugin_task_list::{task_item, task_list};


let config = EditorConfig::builder()
    .plugin(paragraph())
    .plugin(bullet_list())
    .plugin(list_item())
    .plugin(list_keymap())
    .plugin(ordered_list())
    .plugin(task_item())
    .plugin(task_list())
    .build()?;
let mut editor = Editor::from_document(&config, vec![Node::textblock("paragraph", "")])?;
editor.insert_text("[ ] ")?;
editor.insert_text("Review the copy")?;


assert_eq!(editor.document().blocks()[0].kind, "taskList");
```

The space after `[ ]` triggers the input rule. The second call inserts the label inside the new unchecked item.

## Settings

To allow a task item to contain another list, enable [nested task items](/docs/plugins/structure/task-list/).

## Commands

### Switch list type

With the caret inside a bullet list, run the task list toggle to convert it to a checklist.

```rust
editor.run(gpdoc_plugin_task_list::Toggle)?;
```

### List plugins

| Registration                                                          | Commands and where to use them                                                                                                                                                                                          |
| --------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`bullet_list()`](/docs/plugins/structure/bullet-list/)               | `wrapInBulletList` wraps paragraphs. `toggleBulletList` also lifts bullet items or converts a compatible list.                                                                                                          |
| [`ordered_list()`](/docs/plugins/structure/ordered-list/)             | `wrapInOrderedList` and `toggleOrderedList` work on the corresponding paragraphs or list. For a new list, pass an integer `start` (default `1`) and an optional string `type` (default `null`).                         |
| [`list_item()`](/docs/plugins/structure/list-item/)                   | `splitListItem` splits at a text selection in one paragraph. `sinkListItem` nests the item under its preceding sibling. `liftListItem` moves it up a level.                                                             |
| [`task_list()` and `task_item()`](/docs/plugins/structure/task-list/) | `toggleTaskList` wraps paragraphs, lifts task items, or converts a compatible list. Inside a task item, `splitTaskItem` splits its paragraph and `liftTaskItem` lifts the item. New items default to `checked = false`. |
| [`list_keymap()`](/docs/plugins/structure/list-keymap/)               | With a caret at an item boundary, `listBackspace` lifts or joins and `listDelete` joins forward. At the start of a block after a list, `listTab` moves the block into the preceding item when the schema permits it.    |

## Keyboard shortcuts

Use **Mod + Shift + 8** for bullets, **Mod + Shift + 7** for numbering, and **Mod + Shift + 9** for a checklist. Inside an item, **Enter** splits at the caret. On an empty item it lifts the item one level.

At the start of an empty paragraph, type `-`, `1.`, or `[ ]` followed by a space to create a bullet, numbered step, or unchecked task.