Skip to content

Add nospell option to vimtex_syntax_custom_cmds #2240

@krissen

Description

@krissen

Consider the commands \citeyear[n]{foo} and \parencite[n]{bar}.

Without any extra options, the commands are not folded and the content foo and bar is spellchecked. I'd like them folded and not spellchecked.

The following removes spellchecking of them correctly:

let g:vimtex_syntax_nospell_commands=[ "citeyear", "parencite" ]

And the following makes them fold correctly:

let g:vimtex_syntax_custom_cmds = [
      \ {'name': 'citeyear', 'opt': 1, 'conceal': 1},
      \ {'name': 'parencite', 'opt': 1, 'conceal': 1},
      \]

However, including both nospell_commands and custom_cmds, the commands are still folded but also spellchecked. The latter is the problem. It seems that having both commands, custom_cmds takes precedence and the nospell_commands is ignored.

Suggestion: add a variable spell, nospell or some such, to disable spelling in created custom_cmds.

An alternative option would be if nospell_commands and custom_cmds would not clash.

A third option to add the various citation commands* to be identified in the same way as \cite. Although that would be great, the initial suggestion would also be good, I think, as it covers a wider use-case.

* \footcite, \parencite, \parencites, \fullcite, \citeyear, \citeauthor, \textcite, \citet, \citep, \citealp ... well, the list does go on I guess.

PS. Shouldn't the variables be named in a similar fashion; that is either the _commands part of g:vimtex_syntax_nospell_commands should be abbreviated to _cmds or that the _cmds part of g:vimtex_syntax_custom_cmds shouldn't be abbreviated but spelt out as _commands?

EDIT: Clarified a paragraph and added the PS.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions