Skip to content

Conceal Support for 2-Command Arguments #2666

@EmperorEntropy

Description

@EmperorEntropy

Is your feature request related to a problem? Please describe it.
My feature request is related to an interesting article I read on Unicode Plain Tex Encoding for math. One of the unicode "simplifications" intrigued me, and it was how \binom{n}{k} was simplified into (n¦k). I would like to have a similar functionality with Vimtex's conceal system.

Describe the solution you'd like
To be precise, I would like conceal support for 2-command arguments, which are arguments that look like \cmd{}{}. Perhaps a command like g:vimtex_syntax_custom_cmds_with_two_args would work? For the example I want, it could look like the following

let g:vimtex_syntax_custom_cmds_with_two_args = [
          \ {'name': 'binom',
          \  'mathmode': 1,
          \  'cchar_open': '(',
          \ 'cchar_mid': '¦',
          \  'cchar_close': ')'},
          \]

where cchar_open is inserted before the first argument, cchar_mid is the char inserted between the two arguments, and cchar_close is inserted after the second argument. So, something like \binom{4}{2} would appear as (4¦2).

Ideally, cchar_open and cchar_close would be optional, allowing for cases where we don't need them as part of the concealment. A basic example would be fractions, and possible customization for it might look like:

let g:vimtex_syntax_custom_cmds_with_two_args = [
          \ {'name': 'frac',
          \  'mathmode': 1,
          \ 'cchar_mid': '/'},
          \]

In this case, \frac{2}{3} could become 2/3 under concealment.

This seems rather complex to implement, but hopefully something like this would be possible to have. It would make concealment be a lot more useful. Thank you for considering this suggestion!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions