patch 9.2.0718: :syn sync without an argument also lists syntax cluster
Commit:
https://github.com/vim/vim/commit/f2954c821ebf007503bc29cd25d01974f691432c
Author: Dmytro Meleshko <
dmytro....@gmail.com>
Date: Wed Jun 24 17:51:22 2026 +0000
patch 9.2.0718: :syn sync without an argument also lists syntax cluster
Problem: :syn sync without an argument also lists every defined cluster
Solution: Fix control flow in syn_cmd_list() so that only the syncing
items are printed when this function gets called by :syn sync.
(dmitmel)
closes: #20614
Signed-off-by: Dmytro Meleshko <
dmytro....@gmail.com>
Signed-off-by: Christian Brabandt <
c...@256bit.org>
diff --git a/src/po/vim.pot b/src/po/vim.pot
index bbbf9f0cc..131e52457 100644
--- a/src/po/vim.pot
+++ b/src/po/vim.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Vim
"
"Report-Msgid-Bugs-To:
vim...@vim.org
"
-"POT-Creation-Date: 2026-06-22 19:36+0000
"
+"POT-Creation-Date: 2026-06-24 17:52+0000
"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE
"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>
"
"Language-Team: LANGUAGE <
L...@li.org>
"
@@ -3109,26 +3109,26 @@ msgstr ""
msgid "syncing on C-style comments"
msgstr ""
-msgid "no syncing"
+msgid ""
+"
"
+"--- Syntax sync items ---"
msgstr ""
-msgid "syncing starts at the first line"
+msgid ""
+"
"
+"syncing on items"
msgstr ""
-msgid "syncing starts "
+msgid "no syncing"
msgstr ""
-msgid " lines before top line"
+msgid "syncing starts at the first line"
msgstr ""
-msgid ""
-"
"
-"--- Syntax sync items ---"
+msgid "syncing starts "
msgstr ""
-msgid ""
-"
"
-"syncing on items"
+msgid " lines before top line"
msgstr ""
msgid ""
diff --git a/src/syntax.c b/src/syntax.c
index 4333c3183..6f22d9ece 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -3834,9 +3834,22 @@ syn_cmd_list(
msg_puts(_("syncing on C-style comments"));
syn_lines_msg();
syn_match_msg();
- return;
}
- else if (!(curwin->w_s->b_syn_sync_flags & SF_MATCH))
+ else if (curwin->w_s->b_syn_sync_flags & SF_MATCH)
+ {
+ msg_puts_title(_("
--- Syntax sync items ---"));
+ if (curwin->w_s->b_syn_sync_minlines > 0
+ || curwin->w_s->b_syn_sync_maxlines > 0
+ || curwin->w_s->b_syn_sync_linebreaks > 0)
+ {
+ msg_puts(_("
syncing on items"));
+ syn_lines_msg();
+ syn_match_msg();
+ }
+ for (id = 1; id <= highlight_num_groups() && !got_int; ++id)
+ syn_list_one(id, syncing, FALSE);
+ }
+ else
{
if (curwin->w_s->b_syn_sync_minlines == 0)
msg_puts(_("no syncing"));
@@ -3852,20 +3865,11 @@ syn_cmd_list(
}
syn_match_msg();
}
- return;
- }
- msg_puts_title(_("
--- Syntax sync items ---"));
- if (curwin->w_s->b_syn_sync_minlines > 0
- || curwin->w_s->b_syn_sync_maxlines > 0
- || curwin->w_s->b_syn_sync_linebreaks > 0)
- {
- msg_puts(_("
syncing on items"));
- syn_lines_msg();
- syn_match_msg();
}
+ return;
}
- else
- msg_puts_title(_("
--- Syntax items ---"));
+
+ msg_puts_title(_("
--- Syntax items ---"));
if (ends_excmd2(eap->cmd, arg))
{
/*
diff --git a/src/testdir/test_syntax.vim b/src/testdir/test_syntax.vim
index 170e2e3b9..d4a81dd65 100644
--- a/src/testdir/test_syntax.vim
+++ b/src/testdir/test_syntax.vim
@@ -419,6 +419,25 @@ func Test_syn_sync()
call assert_match('SyncHere', execute('syntax sync'))
syn sync clear
call assert_notmatch('SyncHere', execute('syntax sync'))
+
+ syn sync minlines=10
+ syntax cluster xmlStuff contains=xmlGroup1,xmlGroup2
+ syntax region xmlComment start=/<!--/ end=/-->/ keepend contains=@Spell
+ syntax sync match xmlSync1 grouphere xmlComment /<!--/
+ syntax sync match xmlSync2 groupthere NONE /-->/
+ syntax cluster xmlAll contains=ALL
+ let out = execute('syntax sync')
+ call assert_match('xmlSync1', out)
+ call assert_match('xmlSync2', out)
+ call assert_match('grouphere xmlComment', out)
+ call assert_match('groupthere NONE', out)
+ call assert_notmatch('xmlStuff', out)
+ call assert_notmatch('xmlAll', out)
+ call assert_notmatch('cluster', out)
+ call assert_notmatch('keepend', out)
+ " should output 4 lines: 1 header + 3 syn sync lines
+ call assert_equal(4, len(split(out, '
')))
+
syn clear
endfunc
diff --git a/src/version.c b/src/version.c
index 72f154f3e..7fd7b6b80 100644
--- a/src/version.c
+++ b/src/version.c
@@ -759,6 +759,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 718,
/**/
717,
/**/