Skip to content

Expanding ToC syntax for sections #2221

@yongrenjie

Description

@yongrenjie

Is your feature request related to a problem? Please describe it.

In the ToC, chapter/section labels like chap:foo or sec:bar get special syntax highlighting as defined in autoload/vimtex/toc.vim

syntax match VimtexTocLabelsSecs /\v(chap|sec):.*$/ contained
syntax match VimtexTocLabelsEq /eq:.*$/ contained
syntax match VimtexTocLabelsFig /fig:.*$/ contained
syntax match VimtexTocLabelsTab /tab:.*$/ contained

It might be nice to be able to configure this, e.g. for subsections subsec:baz, or or if someone wanted to use a different abbreviation, say \label{chpt:foo} (I'm not sure whether there's an 'official' guide on what abbreviations to use, or whether it's just a convention 😄). Basically, something like g:vimtex_toc_todo_labels but for sections instead of todos. (probably simpler than the todo labels, actually)

Right now subsections especially tend to get a little bit messed up because the syntax matches the second half of subsec:baz, e.g.

Screenshot 2021-10-25 at 9 55 52 PM

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions