From 3268c11f1957676cb6698c1ed66c192297865690 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Mon, 26 Jul 2021 21:50:24 -0300 Subject: [PATCH 1/2] Allow optional group in nospell commands When a command is in g:vimtex_syntax_nospell_commands, its argument is excluded from spell checking; after this patch this also works for commands with an optional argument. --- autoload/vimtex/syntax/core.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/autoload/vimtex/syntax/core.vim b/autoload/vimtex/syntax/core.vim index c001c31128..5b7f8b3868 100644 --- a/autoload/vimtex/syntax/core.vim +++ b/autoload/vimtex/syntax/core.vim @@ -284,8 +284,9 @@ function! vimtex#syntax#core#init() abort " {{{1 " Add @NoSpell for commands per configuration (TOP,@Spell implies NoSpell!) for l:macro in g:vimtex_syntax_nospell_commands - execute 'syntax match texCmdNoSpell nextgroup=texNoSpellArg skipwhite skipnl "\\' . l:macro . '"' + execute 'syntax match texCmdNoSpell nextgroup=texNoSpellOpt,texNoSpellArg skipwhite skipnl "\\' . l:macro . '"' endfor + call vimtex#syntax#core#new_opt('texNoSpellOpt', {'next': 'texNoSpellArg'}) call vimtex#syntax#core#new_arg('texNoSpellArg', {'contains': 'TOP,@Spell'}) " \begin \end environments @@ -758,6 +759,7 @@ function! vimtex#syntax#core#init_highlights() abort " {{{1 highlight def link texNewthmArgName texArg highlight def link texNewthmOptCounter texOpt highlight def link texNewthmOptNumberby texOpt + highlight def link texNoSpellOpt texOpt highlight def link texOptEqual texSymbol highlight def link texParboxOptHeight texError highlight def link texParboxOptIPos texError From 310119e3675913f2e93de7e6f6df2b094c839360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Mon, 26 Jul 2021 21:56:38 -0300 Subject: [PATCH 2/2] Allow more than one argument in nospell commands After this patch, a command in g:vimtex_syntax_nospell_commands can have more than one mandatory argument; spell check is disabled for all of them. --- autoload/vimtex/syntax/core.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/vimtex/syntax/core.vim b/autoload/vimtex/syntax/core.vim index 5b7f8b3868..704de7329e 100644 --- a/autoload/vimtex/syntax/core.vim +++ b/autoload/vimtex/syntax/core.vim @@ -287,7 +287,7 @@ function! vimtex#syntax#core#init() abort " {{{1 execute 'syntax match texCmdNoSpell nextgroup=texNoSpellOpt,texNoSpellArg skipwhite skipnl "\\' . l:macro . '"' endfor call vimtex#syntax#core#new_opt('texNoSpellOpt', {'next': 'texNoSpellArg'}) - call vimtex#syntax#core#new_arg('texNoSpellArg', {'contains': 'TOP,@Spell'}) + call vimtex#syntax#core#new_arg('texNoSpellArg', {'next': 'texNoSpellArg', 'contains': 'TOP,@Spell'}) " \begin \end environments syntax match texCmdEnv "\v\\%(begin|end)>" nextgroup=texEnvArgName