# HG changeset patch # User Christian Brabandt # Date 1692552604 -7200 # Node ID dcab5385dd020c60f47df8a954c426747ad9ead4 # Parent ba87e3f0ffe49dabd9283e9f1b15d71af1a6e9f5 patch 9.0.1767: '.-' no allowed in highlight group names Commit: https://github.com/vim/vim/commit/d4376dc3ebea91abcb4d9ef9963ef5b968048b78 Author: Gregory Anders Date: Sun Aug 20 19:14:03 2023 +0200 patch 9.0.1767: '.-' no allowed in highlight group names Problem: '.-' no allowed in highlight group names Solution: Allow dot and hyphen characters in highlight group names Allow dots and hyphens in group names. There does not seem to be any reason for these to be disallowed. closes: #12807 Signed-off-by: Christian Brabandt Co-authored-by: Gregory Anders Co-authored-by: Sean Dewar diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -214,10 +214,10 @@ A syntax group name is to be used for sy thing. These are then linked to a highlight group that specifies the color. A syntax group name doesn't specify any color or attributes itself. -The name for a highlight or syntax group must consist of ASCII letters, digits -and the underscore. As a regexp: "[a-zA-Z0-9_]*". However, Vim does not give -an error when using other characters. The maximum length of a group name is -about 200 bytes. *E1249* +The name for a highlight or syntax group must consist of ASCII letters, +digits, underscores, dots, or hyphens. As a regexp: "[a-zA-Z0-9_.-]*". +However, Vim does not give an error when using other characters. The maximum +length of a group name is about 200 bytes. *E1249* To be able to allow each user to pick their favorite set of colors, there must be preferred names for highlight groups that are common for many languages. diff --git a/src/highlight.c b/src/highlight.c --- a/src/highlight.c +++ b/src/highlight.c @@ -3452,7 +3452,7 @@ syn_add_group(char_u *name) char_u *p; char_u *name_up; - // Check that the name is ASCII letters, digits and underscore. + // Check that the name is valid (ASCII letters, digits, underscores, dots, or hyphens). for (p = name; *p != NUL; ++p) { if (!vim_isprintc(*p)) @@ -3461,7 +3461,7 @@ syn_add_group(char_u *name) vim_free(name); return 0; } - else if (!ASCII_ISALNUM(*p) && *p != '_') + else if (!ASCII_ISALNUM(*p) && *p != '_' && *p != '.' && *p != '-') { // This is an error, but since there previously was no check only // give a warning. diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -696,6 +696,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1767, +/**/ 1765, /**/ 1764,