1

According to :syn-define,

several syntax ITEMs can be put into one syntax GROUP.

Am I correct to infer that, regardless of the number of ITEM
instances, e.g.,

syn keyword alphaBeta alpha beta
syn match alphaBeta "\<α\>"
syn match alphaBeta "\<β\>"

the ITEMs that share a syntax-group name make a single
syntax group (e.g. alphaBeta)?

In general, syntax commands :syn-keyword, :syn-match,
:syn-region, and :syn-cluster take arguments that expect
a list of comma-separated syntax-group names and
@clusterName references. These arguments, at large, are
contains, containedin, nextgroup, matchgroup, add,
and remove.

Is there any significance in duplicating a syntax-group name
in any such arguments?

E.g.

syn cluster greekLetters add=alphaBeta,alphaBeta,alphaBeta

There are instances of such duplication in a few distributed
syntax files.

Try on a local copy:

cd repos/vim/vim/
ack --vim --max-count=1 '(\b\D\w+\b),\b\1\b' runtime/syntax/
7
  • Welcome to Vi and Vim! I honestly suspect these are typos… but best to ask the mailing list/issue tracker to be sure
    – D. Ben Knoble
    May 19, 2022 at 15:15
  • Searches: rg -t vim --pcre2 '(\b\D\w+\b),\b1\b' $vim_source/runtime/syntax/; git -C $vim_source grep -P '(\b\D\w+\b),\b1\b' -- 'runtime/syntax/*.vim'; :vimgrep /\(\<\D\w\+\>\),\<\1\>/ $VIMRUNTIME/syntax/*.vim (takes a few seconds, so use a good :grep if you can)
    – D. Ben Knoble
    May 19, 2022 at 15:31
  • An issue was filed. May 20, 2022 at 18:05
  • @D.BenKnoble The search pattern for the git-grep command should reach for a backreference (\1), not a number (1) after the comma (,): git -C $vim_source grep -P '(\b\D\w+\b),\b\1\b' -- 'runtime/syntax/*.vim'. May 20, 2022 at 18:08
  • Good catch; i think the backslashes just got lost
    – D. Ben Knoble
    May 21, 2022 at 1:58

1 Answer 1

2

Repeated syntax-group names and cluster references are
superfluous in a particular syntax command argument; when
found, they are quietly passed over.

Read Bram Moolenaar's comment in the discussion held on
the subject.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.