Skip to content
github-actions[bot] edited this page Feb 25, 2025 · 42 revisions

core.qol.toc

A Bird's Eye View of Norg Documents

The TOC module generates a table of contents for a given Norg buffer.

Overview

The TOC module exposes a single command - :Neorg toc. This command can be executed with one of three optional arguments: left, right and qflist.

When left or right is supplied, the Table of Contents split is placed on that side of the screen. When the qflist argument is provided, the whole table of contents is sent to the Neovim quickfix list, should that be more convenient for you.

When in the TOC view, <CR> can be pressed on any of the entries to move to that location in the respective Norg document. The TOC view updates automatically when switching buffers.

Configuration

  • auto_toc
    (table)

    Options for automatically opening/entering the ToC window

    • close
      (boolean)

      Automatically close the ToC window when there is no longer an open norg buffer

      true
    • enter
      (boolean)

      Enter an automatically opened ToC window

      false
    • exit_nvim
      (boolean)

      Will exit nvim if the ToC is the last buffer on the screen, similar to help windows

      true
    • open
      (boolean)

      Automatically open a ToC window when entering any norg buffer

      false
  • close_after_use
    (boolean)

    Close the Table of Contents after an entry in the table is picked

    false
  • enter
    (boolean)

    Enter a ToC window opened manually (any ToC window not opened by auto_toc)

    true
  • fit_width
    (boolean)

    Width of the Table of Contents window will automatically fit its longest line, up to max_width

    true
  • fixed_width
    (nil)

    When set, the ToC window will always be this many cols wide. will override fit_width and ignore max_width

    nil
  • max_width
    (number)

    Max width of the ToC window when fit_width = true (in columns)

    30
  • sync_cursorline
    (boolean)

    Enable cursorline in the ToC window, and sync the cursor position between ToC and content window

    true

Dependencies

  • core.integrations.treesitter - A module designed to integrate Treesitter into Neorg.
  • core.ui - A set of public functions to help developers create and manage UI (selection popups, prompts...) in their modules.
Clone this wiki locally