First: This is not related to vim-lexical
. Syntax rules define where spell checking should be done, and so the current behaviour is defined by the internal syntax plugin for LaTeX.
The default syntax rule for tex command arguments allows spell checking. Some commands, e.g. \include{...}
, are not spell checked. This is controlled by the @Spell
and @NoSpell
syntax clusters, see :h spell-syntax
and :h syn-spell
.
In order to add your own rules, you can create the file .vim/after/syntax/tex.vim
. An example rule that will match \includepdf
and prevent spelling is:
syntax match texInputFile /\\includepdf\%(\[.\{-}\]\)\=\s*{.\{-}}/
\ contains=texStatement,texInputCurlies,texInputFileOpt
Note that this rule makes the syntax matching of \includepdf
correspond to \include
and similar commands. To prevent spelling of other commands where such a correspondence does not make sense, you could also use:
syntax match texStatement '\\includepdf' nextgroup=texMyNoSpell
syntax region texMyNoSpell matchgroup=Delimiter start='{' end='}' contained
\ contains=@NoSpell
Note: Please don't hesitate to open issues with vimtex for things like this. vimtex provides some updates to the syntax rules on top of the internal syntax plugin, and the \includepdf
command is a good example of commands I personally think should be matched.