Closed timokau closed 4 years ago
Thanks for opening a new issue for this discussion!
I'm thinking the option should be something like this:
let g:vimtex_syntax_nospell_commands = [
\ 'bibliographystyle',
\ 'mycustommacro',
\ 'myothercustommacro',
\]
Each entry should be interpreted as a regular expression to match a macro name, where the \
is implied. Most often, you would just write the full name, but if you e.g. define several similar commands you could match all with 'mycmd\(one\|two\)'
. The default value is an empty list, because vimtex aims to have quite wide support for common packages.
List of TODOs:
g:vimtex_syntax_nospell_commands
(default empty list) such that for each macro, the corresponding argument in {...}
is matched with @NoSpell
.Note: This will add relatively top level syntax matches (except they need to be contained in the texDocument
and similar), and it is not possible to combine the @NoSpell
with other syntax features through this mechanism alone.
What do you think?
Sounds good! Regarding the naming I would find "commands" a bit more intuitive, since you are declaring them with newcommand
. Or is there an actual difference between a "command" and a "macro"?
I don't feel very strongly about it either way though. I just think the user is more likely to search for "command", at least I would be.
Sounds good! Regarding the naming I would find "commands" a bit more intuitive, since you are declaring them with newcommand. Or is there an actual difference between a "command" and a "macro"?
Thanks, I agree.
I think this should do it. Please test.
Continuing the discussion from https://github.com/lervag/vimtex/issues/562#issuecomment-659229363. I still think such an option would be desirable and it could be done in addition to exludes in package scripts.
Package scripts in vimtex are inherently limited to at least somewhat popular commands. They do not work as soon as I use
\newcommand\mygls\gls
. Therefore I think a low-friction way of adding additional excludes would be nice. Benefits includeThis feature is strictly a nice-to-have, not a must-have. I thought it couldn't hurt to continue the discussion here, but I understand if you just close this issue.