Skip to content
github-actions[bot] edited this page Jul 16, 2024 · 37 revisions

core.itero

Fast List/Heading Continuation

Fluidness is key, after all.

module-showcase

Overview

core.itero is a rather small and simple module designed to assist in the creation of many lists, headings and other repeatable (iterable) items.

By default, the key that is used to iterate on an item is <M-CR> (Alt + Enter). If you want to change the bind, remap the core.itero.next-iteration event.

Begin by writing an initial item you'd like to iterate (in this instance, and unordered list item):

- Hello World!

With your cursor in insert mode at the end of the line, pressing the keybind will continue the item at whatever nesting level it is currently at (where | is the new cursor position):

- Hello World!
- |

The same can also be done for headings:

* Heading 1
* |

This functionality is commonly paired with the core.promo module to then indent/dedent the item under the cursor with the <C-t> and <C-d> bindings.

Configuration

  • iterables
    (list)

    A list of lua patterns detailing what treesitter nodes can be "iterated". Usually doesn't need to be changed, unless you want to disable some items from being iterable.

    • (string)
      "unordered_list%d"
    • (string)
      "ordered_list%d"
    • (string)
      "heading%d"
    • (string)
      "quote%d"
  • retain_extensions
    (table)

    Which item types to retain extensions for.

    If the item you are currently iterating has an extension (e.g. ( ), (x) etc.), then the following items will also have an extension (by default ( )) attached to them automatically.

    • ordered_list%d
      (boolean)

      true
    • unordered_list%d
      (boolean)

      true

Dependencies

Clone this wiki locally