@@ -1080,6 +1080,8 @@ function! vimtex#syntax#core#new_cmd(cfg) abort " {{{1
10801080 let l: group_cmd = l: pre . ' Cmd' . l: name
10811081 let l: group_opt = l: pre . l: name . ' Opt'
10821082 let l: group_arg = l: pre . l: name . ' Arg'
1083+ let l: group_arg_space = l: pre . l: name . ' Argspace'
1084+ let l: group_arg_char = l: pre . l: name . ' ArgChar'
10831085
10841086 " Specify rules for next groups
10851087 if ! empty (l: cfg .nextgroup)
@@ -1092,7 +1094,7 @@ function! vimtex#syntax#core#new_cmd(cfg) abort " {{{1
10921094
10931095 let l: opt_cfg = {' opts' : l: cfg .optconceal ? ' conceal' : ' ' }
10941096 if l: cfg .arg
1095- let l: opt_cfg .next = l: group_arg
1097+ let l: opt_cfg .next = l: group_arg_space
10961098 endif
10971099 call vimtex#syntax#core#new_opt (l: group_opt , l: opt_cfg )
10981100
@@ -1101,7 +1103,13 @@ function! vimtex#syntax#core#new_cmd(cfg) abort " {{{1
11011103
11021104 " Add syntax rules for the argument group
11031105 if l: cfg .arg
1104- let l: nextgroups += [l: group_arg ]
1106+ let l: nextgroups += [l: group_arg_space ]
1107+
1108+ execute ' syntax match' l: group_arg_space ' "\s*"'
1109+ \ ' contained nextgroup=' .. l: group_arg_char .. ' ,' .. l: group_arg
1110+ \ l: cfg .conceal ? ' conceal' : ' '
1111+
1112+ execute ' syntax match' l: group_arg_char ' "\w"' ' contained'
11051113
11061114 let l: arg_cfg = {' opts' : ' contained' }
11071115 if l: cfg .conceal && empty (l: cfg .concealchar)
@@ -1128,6 +1136,7 @@ function! vimtex#syntax#core#new_cmd(cfg) abort " {{{1
11281136 \} , l: cfg .argstyle,
11291137 \ l: cfg .mathmode ? ' texMathArg' : ' ' )
11301138 if ! empty (l: style )
1139+ execute ' highlight def link' l: group_arg_char l: style
11311140 execute ' highlight def link' l: group_arg l: style
11321141 endif
11331142 endif
0 commit comments