changeset 35378:105d15aef7dd

runtime(vim): Update base-syntax, configurable comment string highlighting (#14931) Commit: https://github.com/vim/vim/commit/959c3c887b2e52c7141b2a09a53634481911b1b7 Author: dkearns <dougkearns@gmail.com> Date: Wed Jun 12 04:18:08 2024 +1000 runtime(vim): Update base-syntax, configurable comment string highlighting (https://github.com/vim/vim/issues/14931) Allow highlighting of strings within comments to be disabled by setting g:vimsyn_comment_strings to false. Signed-off-by: Doug Kearns <dougkearns@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Tue, 11 Jun 2024 20:30:03 +0200
parents 763784b5860b
children 1676f089f1d5
files runtime/doc/syntax.txt runtime/doc/tags runtime/syntax/generator/vim.vim.base runtime/syntax/testdir/dumps/vim9_ex_comment_strings_00.dump runtime/syntax/testdir/dumps/vim9_ex_comment_strings_01.dump runtime/syntax/testdir/dumps/vim9_ex_comment_strings_99.dump runtime/syntax/testdir/dumps/vim9_ex_no_comment_strings_00.dump runtime/syntax/testdir/dumps/vim9_ex_no_comment_strings_01.dump runtime/syntax/testdir/dumps/vim9_ex_no_comment_strings_99.dump runtime/syntax/testdir/dumps/vim_ex_comment_strings_00.dump runtime/syntax/testdir/dumps/vim_ex_comment_strings_99.dump runtime/syntax/testdir/dumps/vim_ex_no_comment_strings_00.dump runtime/syntax/testdir/dumps/vim_ex_no_comment_strings_99.dump runtime/syntax/testdir/input/vim9_ex_comment_strings.vim runtime/syntax/testdir/input/vim9_ex_no_comment_strings.vim runtime/syntax/testdir/input/vim_ex_comment_strings.vim runtime/syntax/testdir/input/vim_ex_no_comment_strings.vim runtime/syntax/vim.vim
diffstat 18 files changed, 313 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -3802,19 +3802,18 @@ The g:vimsyn_embed option allows users t
 embedded script highlighting they wish to have. >
 
    g:vimsyn_embed == 0   : don't support any embedded scripts
-   g:vimsyn_embed =~ 'l' : support embedded lua
-   g:vimsyn_embed =~ 'm' : support embedded mzscheme
-   g:vimsyn_embed =~ 'p' : support embedded perl
-   g:vimsyn_embed =~ 'P' : support embedded python
-   g:vimsyn_embed =~ 'r' : support embedded ruby
-   g:vimsyn_embed =~ 't' : support embedded tcl
+   g:vimsyn_embed =~ 'l' : support embedded Lua
+   g:vimsyn_embed =~ 'm' : support embedded MzScheme
+   g:vimsyn_embed =~ 'p' : support embedded Perl
+   g:vimsyn_embed =~ 'P' : support embedded Python
+   g:vimsyn_embed =~ 'r' : support embedded Ruby
+   g:vimsyn_embed =~ 't' : support embedded Tcl
 <
 By default, g:vimsyn_embed is a string supporting interpreters that your vim
 itself supports.  Concatenate the indicated characters to support multiple
-types of embedded interpreters; ie. g:vimsyn_embed = "mp" supports embedded
-mzscheme and embedded perl.
+types of embedded interpreters (e.g., g:vimsyn_embed = "mp" supports embedded
+mzscheme and embedded perl).
 						*g:vimsyn_folding*
-
 Some folding is now supported with when 'foldmethod' is set to "syntax": >
 
    g:vimsyn_folding == 0 or doesn't exist: no syntax-based folding
@@ -3822,19 +3821,23 @@ Some folding is now supported with when 
    g:vimsyn_folding =~ 'f' : fold functions
    g:vimsyn_folding =~ 'h' : fold heredocs
    g:vimsyn_folding =~ 'H' : fold Vim9-script legacy headers
-   g:vimsyn_folding =~ 'l' : fold lua      script
-   g:vimsyn_folding =~ 'm' : fold mzscheme script
-   g:vimsyn_folding =~ 'p' : fold perl     script
-   g:vimsyn_folding =~ 'P' : fold python   script
-   g:vimsyn_folding =~ 'r' : fold ruby     script
-   g:vimsyn_folding =~ 't' : fold tcl      script
+   g:vimsyn_folding =~ 'l' : fold Lua      script
+   g:vimsyn_folding =~ 'm' : fold MzScheme script
+   g:vimsyn_folding =~ 'p' : fold Perl     script
+   g:vimsyn_folding =~ 'P' : fold Python   script
+   g:vimsyn_folding =~ 'r' : fold Ruby     script
+   g:vimsyn_folding =~ 't' : fold Tcl      script
 <
 
 By default, g:vimsyn_folding is unset.  Concatenate the indicated characters
-to support folding of multiple syntax constructs; i.e.
-g:vimsyn_folding = "fh" will enable folding of both functions and heredocs.
-
-							*g:vimsyn_noerror*
+to support folding of multiple syntax constructs (e.g.,
+g:vimsyn_folding = "fh" will enable folding of both functions and heredocs).
+
+						*g:vimsyn_comment_strings*
+By default, strings are highlighted inside comments.  This may be disabled by
+setting g:vimsyn_comment_strings to false.
+
+						*g:vimsyn_noerror*
 Not all error highlighting that syntax/vim.vim does may be correct; Vim script
 is a difficult language to highlight correctly.  A way to suppress error
 highlighting is to put the following line in your |vimrc|: >
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -7709,6 +7709,7 @@ g:vim_indent	indent.txt	/*g:vim_indent*
 g:vim_indent_cont	indent.txt	/*g:vim_indent_cont*
 g:vimball_home	pi_vimball.txt	/*g:vimball_home*
 g:vimball_mkdir	pi_vimball.txt	/*g:vimball_mkdir*
+g:vimsyn_comment_strings	syntax.txt	/*g:vimsyn_comment_strings*
 g:vimsyn_embed	syntax.txt	/*g:vimsyn_embed*
 g:vimsyn_folding	syntax.txt	/*g:vimsyn_folding*
 g:vimsyn_maxlines	syntax.txt	/*g:vimsyn_maxlines*
--- a/runtime/syntax/generator/vim.vim.base
+++ b/runtime/syntax/generator/vim.vim.base
@@ -369,7 +369,9 @@ syn region	vimUserCmdBlock	contained	mat
 
 " Lower Priority Comments: after some vim commands... {{{2
 " =======================
-syn region	vimCommentString	contained oneline start='\S\s\+"'ms=e end='"'
+if get(g:, "vimsyn_comment_strings", 1)
+  syn region	vimCommentString	contained oneline start='\S\s\+"'ms=e end='"'
+endif
 
 if s:vim9script
   syn match	vimComment	excludenl +\s"[^\-:.%#=*].*$+lc=1	contains=@vimCommentGroup,vimCommentString contained
new file mode 100644
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_ex_comment_strings_00.dump
@@ -0,0 +1,20 @@
+>v+0#af5f00255#ffffff0|i|m|9|s|c|r|i|p|t| +0#0000000&@64
+@75
+|#+0#0000e05&| |V|i|m| |c|o|m@1|e|n|t| |s|t|r|i|n|g|s| +0#0000000&@53
+|#+0#0000e05&| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |l|e|t| |g|:|v|i|m|s|y|n|_|c|o|m@1|e|n|t|_|s|t|r|i|n|g|s| |=| |v|:|t|r|u|e| +0#0000000&@20
+@75
+|#+0#0000e05&| |p|r|e| |"+0#e000002&|s|t|r|i|n|g|"| +0#0000e05&|p|o|s|t| +0#0000000&@55
+@75
+|f+0#af5f00255&|u|n|c|t|i|o|n| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&@60
+| +0#0000e05&@1|"| |p|r|e| |"+0#e000002&|s|t|r|i|n|g|"| +0#0000e05&|p|o|s|t| +0#0000000&@53
+|e+0#af5f00255&|n|d|f|u|n|c|t|i|o|n| +0#0000000&@63
+@75
+|d+0#af5f00255&|e|f| +0#0000000&|B|a|r|(+0#e000e06&|)| +0#0000000&@65
+| +0#0000e05&@1|#| |p|r|e| |"+0#e000002&|s|t|r|i|n|g|"| +0#0000e05&|p|o|s|t| +0#0000000&@53
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
+@75
+|c+0#af5f00255&|o|m@1|a|n|d| +0#0000000&|F|o@1| |{+0#e000e06&| +0#0000000&@61
+| +0#0000e05&@1|#| |p|r|e| |"+0#e000002&|s|t|r|i|n|g|"| +0#0000e05&|p|o|s|t| +0#0000000&@53
+|}+0#e000e06&| +0#0000000&@73
+@75
+@57|1|,|1| @10|T|o|p| 
new file mode 100644
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_ex_comment_strings_01.dump
@@ -0,0 +1,20 @@
+|e+0#af5f00255#ffffff0|n|d@1|e|f| +0#0000000&@68
+@75
+|c+0#af5f00255&|o|m@1|a|n|d| +0#0000000&|F|o@1| |{+0#e000e06&| +0#0000000&@61
+| +0#0000e05&@1|#| |p|r|e| |"+0#e000002&|s|t|r|i|n|g|"| +0#0000e05&|p|o|s|t| +0#0000000&@53
+|}+0#e000e06&| +0#0000000&@73
+> @74
+|a+0#af5f00255&|u|t|o|c|m|d| +0#0000000&|B+0#00e0003&|u|f|N|e|w|F|i|l|e| +0#0000000&|*| |{+0#e000e06&| +0#0000000&@52
+| +0#0000e05&@1|#| |p|r|e| |"+0#e000002&|s|t|r|i|n|g|"| +0#0000e05&|p|o|s|t| +0#0000000&@53
+|}+0#e000e06&| +0#0000000&@73
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|1|9|,|0|-|1| @7|B|o|t| 
new file mode 100644
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_ex_comment_strings_99.dump
@@ -0,0 +1,20 @@
+|#+0#0000e05#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |l|e|t| |g|:|v|i|m|s|y|n|_|c|o|m@1|e|n|t|_|s|t|r|i|n|g|s| |=| |v|:|t|r|u|e| +0#0000000&@20
+@75
+|#+0#0000e05&| |p|r|e| |"+0#e000002&|s|t|r|i|n|g|"| +0#0000e05&|p|o|s|t| +0#0000000&@55
+@75
+|f+0#af5f00255&|u|n|c|t|i|o|n| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&@60
+| +0#0000e05&@1|"| |p|r|e| |"+0#e000002&|s|t|r|i|n|g|"| +0#0000e05&|p|o|s|t| +0#0000000&@53
+|e+0#af5f00255&|n|d|f|u|n|c|t|i|o|n| +0#0000000&@63
+@75
+|d+0#af5f00255&|e|f| +0#0000000&|B|a|r|(+0#e000e06&|)| +0#0000000&@65
+| +0#0000e05&@1|#| |p|r|e| |"+0#e000002&|s|t|r|i|n|g|"| +0#0000e05&|p|o|s|t| +0#0000000&@53
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
+@75
+|c+0#af5f00255&|o|m@1|a|n|d| +0#0000000&|F|o@1| |{+0#e000e06&| +0#0000000&@61
+| +0#0000e05&@1|#| |p|r|e| |"+0#e000002&|s|t|r|i|n|g|"| +0#0000e05&|p|o|s|t| +0#0000000&@53
+|}+0#e000e06&| +0#0000000&@73
+@75
+|a+0#af5f00255&|u|t|o|c|m|d| +0#0000000&|B+0#00e0003&|u|f|N|e|w|F|i|l|e| +0#0000000&|*| |{+0#e000e06&| +0#0000000&@52
+| +0#0000e05&@1|#| |p|r|e| |"+0#e000002&|s|t|r|i|n|g|"| +0#0000e05&|p|o|s|t| +0#0000000&@53
+>}+0#e000e06&| +0#0000000&@73
+@57|2@1|,|1| @9|B|o|t| 
new file mode 100644
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_ex_no_comment_strings_00.dump
@@ -0,0 +1,20 @@
+>v+0#af5f00255#ffffff0|i|m|9|s|c|r|i|p|t| +0#0000000&@64
+@75
+|#+0#0000e05&| |V|i|m| |c|o|m@1|e|n|t| |s|t|r|i|n|g|s| +0#0000000&@53
+|#+0#0000e05&| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |l|e|t| |g|:|v|i|m|s|y|n|_|c|o|m@1|e|n|t|_|s|t|r|i|n|g|s| |=| |v|:|f|a|l|s|e| +0#0000000&@19
+@75
+|#+0#0000e05&| |p|r|e| |"|s|t|r|i|n|g|"| |p|o|s|t| +0#0000000&@55
+@75
+|f+0#af5f00255&|u|n|c|t|i|o|n| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&@60
+| +0#0000e05&@1|"| |p|r|e| |"|s|t|r|i|n|g|"| |p|o|s|t| +0#0000000&@53
+|e+0#af5f00255&|n|d|f|u|n|c|t|i|o|n| +0#0000000&@63
+@75
+|d+0#af5f00255&|e|f| +0#0000000&|B|a|r|(+0#e000e06&|)| +0#0000000&@65
+| +0#0000e05&@1|#| |p|r|e| |"|s|t|r|i|n|g|"| |p|o|s|t| +0#0000000&@53
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
+@75
+|c+0#af5f00255&|o|m@1|a|n|d| +0#0000000&|F|o@1| |{+0#e000e06&| +0#0000000&@61
+| +0#0000e05&@1|#| |p|r|e| |"|s|t|r|i|n|g|"| |p|o|s|t| +0#0000000&@53
+|}+0#e000e06&| +0#0000000&@73
+@75
+@57|1|,|1| @10|T|o|p| 
new file mode 100644
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_ex_no_comment_strings_01.dump
@@ -0,0 +1,20 @@
+|e+0#af5f00255#ffffff0|n|d@1|e|f| +0#0000000&@68
+@75
+|c+0#af5f00255&|o|m@1|a|n|d| +0#0000000&|F|o@1| |{+0#e000e06&| +0#0000000&@61
+| +0#0000e05&@1|#| |p|r|e| |"|s|t|r|i|n|g|"| |p|o|s|t| +0#0000000&@53
+|}+0#e000e06&| +0#0000000&@73
+> @74
+|a+0#af5f00255&|u|t|o|c|m|d| +0#0000000&|B+0#00e0003&|u|f|N|e|w|F|i|l|e| +0#0000000&|*| |{+0#e000e06&| +0#0000000&@52
+| +0#0000e05&@1|#| |p|r|e| |"|s|t|r|i|n|g|"| |p|o|s|t| +0#0000000&@53
+|}+0#e000e06&| +0#0000000&@73
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|1|9|,|0|-|1| @7|B|o|t| 
new file mode 100644
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_ex_no_comment_strings_99.dump
@@ -0,0 +1,20 @@
+|#+0#0000e05#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |l|e|t| |g|:|v|i|m|s|y|n|_|c|o|m@1|e|n|t|_|s|t|r|i|n|g|s| |=| |v|:|f|a|l|s|e| +0#0000000&@19
+@75
+|#+0#0000e05&| |p|r|e| |"|s|t|r|i|n|g|"| |p|o|s|t| +0#0000000&@55
+@75
+|f+0#af5f00255&|u|n|c|t|i|o|n| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&@60
+| +0#0000e05&@1|"| |p|r|e| |"|s|t|r|i|n|g|"| |p|o|s|t| +0#0000000&@53
+|e+0#af5f00255&|n|d|f|u|n|c|t|i|o|n| +0#0000000&@63
+@75
+|d+0#af5f00255&|e|f| +0#0000000&|B|a|r|(+0#e000e06&|)| +0#0000000&@65
+| +0#0000e05&@1|#| |p|r|e| |"|s|t|r|i|n|g|"| |p|o|s|t| +0#0000000&@53
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
+@75
+|c+0#af5f00255&|o|m@1|a|n|d| +0#0000000&|F|o@1| |{+0#e000e06&| +0#0000000&@61
+| +0#0000e05&@1|#| |p|r|e| |"|s|t|r|i|n|g|"| |p|o|s|t| +0#0000000&@53
+|}+0#e000e06&| +0#0000000&@73
+@75
+|a+0#af5f00255&|u|t|o|c|m|d| +0#0000000&|B+0#00e0003&|u|f|N|e|w|F|i|l|e| +0#0000000&|*| |{+0#e000e06&| +0#0000000&@52
+| +0#0000e05&@1|#| |p|r|e| |"|s|t|r|i|n|g|"| |p|o|s|t| +0#0000000&@53
+>}+0#e000e06&| +0#0000000&@73
+@57|2@1|,|1| @9|B|o|t| 
new file mode 100644
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_comment_strings_00.dump
@@ -0,0 +1,20 @@
+>"+0#0000e05#ffffff0| |V|i|m| |c|o|m@1|e|n|t| |s|t|r|i|n|g|s| +0#0000000&@53
+|"+0#0000e05&| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |l|e|t| |g|:|v|i|m|s|y|n|_|c|o|m@1|e|n|t|_|s|t|r|i|n|g|s| |=| |v|:|t|r|u|e| +0#0000000&@20
+@75
+|"+0#0000e05&| |p|r|e| |"+0#e000002&|s|t|r|i|n|g|"| +0#0000e05&|p|o|s|t| +0#0000000&@55
+@75
+|f+0#af5f00255&|u|n|c|t|i|o|n| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&@60
+| +0#0000e05&@1|"| |p|r|e| |"+0#e000002&|s|t|r|i|n|g|"| +0#0000e05&|p|o|s|t| +0#0000000&@53
+|e+0#af5f00255&|n|d|f|u|n|c|t|i|o|n| +0#0000000&@63
+@75
+|d+0#af5f00255&|e|f| +0#0000000&|B|a|r|(+0#e000e06&|)| +0#0000000&@65
+| +0#0000e05&@1|#| |p|r|e| |"+0#e000002&|s|t|r|i|n|g|"| +0#0000e05&|p|o|s|t| +0#0000000&@53
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
+@75
+|c+0#af5f00255&|o|m@1|a|n|d| +0#0000000&|F|o@1| |{+0#e000e06&| +0#0000000&@61
+| +0#0000e05&@1|#| |p|r|e| |"+0#e000002&|s|t|r|i|n|g|"| +0#0000e05&|p|o|s|t| +0#0000000&@53
+|}+0#e000e06&| +0#0000000&@73
+@75
+|a+0#af5f00255&|u|t|o|c|m|d| +0#0000000&|B+0#00e0003&|u|f|N|e|w|F|i|l|e| +0#0000000&|*| |{+0#e000e06&| +0#0000000&@52
+| +0#0000e05&@1|#| |p|r|e| |"+0#e000002&|s|t|r|i|n|g|"| +0#0000e05&|p|o|s|t| +0#0000000&@53
+@57|1|,|1| @10|T|o|p| 
new file mode 100644
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_comment_strings_99.dump
@@ -0,0 +1,20 @@
+|"+0#0000e05#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |l|e|t| |g|:|v|i|m|s|y|n|_|c|o|m@1|e|n|t|_|s|t|r|i|n|g|s| |=| |v|:|t|r|u|e| +0#0000000&@20
+@75
+|"+0#0000e05&| |p|r|e| |"+0#e000002&|s|t|r|i|n|g|"| +0#0000e05&|p|o|s|t| +0#0000000&@55
+@75
+|f+0#af5f00255&|u|n|c|t|i|o|n| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&@60
+| +0#0000e05&@1|"| |p|r|e| |"+0#e000002&|s|t|r|i|n|g|"| +0#0000e05&|p|o|s|t| +0#0000000&@53
+|e+0#af5f00255&|n|d|f|u|n|c|t|i|o|n| +0#0000000&@63
+@75
+|d+0#af5f00255&|e|f| +0#0000000&|B|a|r|(+0#e000e06&|)| +0#0000000&@65
+| +0#0000e05&@1|#| |p|r|e| |"+0#e000002&|s|t|r|i|n|g|"| +0#0000e05&|p|o|s|t| +0#0000000&@53
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
+@75
+|c+0#af5f00255&|o|m@1|a|n|d| +0#0000000&|F|o@1| |{+0#e000e06&| +0#0000000&@61
+| +0#0000e05&@1|#| |p|r|e| |"+0#e000002&|s|t|r|i|n|g|"| +0#0000e05&|p|o|s|t| +0#0000000&@53
+|}+0#e000e06&| +0#0000000&@73
+@75
+|a+0#af5f00255&|u|t|o|c|m|d| +0#0000000&|B+0#00e0003&|u|f|N|e|w|F|i|l|e| +0#0000000&|*| |{+0#e000e06&| +0#0000000&@52
+| +0#0000e05&@1|#| |p|r|e| |"+0#e000002&|s|t|r|i|n|g|"| +0#0000e05&|p|o|s|t| +0#0000000&@53
+>}+0#e000e06&| +0#0000000&@73
+@57|2|0|,|1| @9|B|o|t| 
new file mode 100644
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_no_comment_strings_00.dump
@@ -0,0 +1,20 @@
+>"+0#0000e05#ffffff0| |V|i|m| |c|o|m@1|e|n|t| |s|t|r|i|n|g|s| +0#0000000&@53
+|"+0#0000e05&| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |l|e|t| |g|:|v|i|m|s|y|n|_|c|o|m@1|e|n|t|_|s|t|r|i|n|g|s| |=| |v|:|f|a|l|s|e| +0#0000000&@19
+@75
+|"+0#0000e05&| |p|r|e| |"|s|t|r|i|n|g|"| |p|o|s|t| +0#0000000&@55
+@75
+|f+0#af5f00255&|u|n|c|t|i|o|n| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&@60
+| +0#0000e05&@1|"| |p|r|e| |"|s|t|r|i|n|g|"| |p|o|s|t| +0#0000000&@53
+|e+0#af5f00255&|n|d|f|u|n|c|t|i|o|n| +0#0000000&@63
+@75
+|d+0#af5f00255&|e|f| +0#0000000&|B|a|r|(+0#e000e06&|)| +0#0000000&@65
+| +0#0000e05&@1|#| |p|r|e| |"|s|t|r|i|n|g|"| |p|o|s|t| +0#0000000&@53
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
+@75
+|c+0#af5f00255&|o|m@1|a|n|d| +0#0000000&|F|o@1| |{+0#e000e06&| +0#0000000&@61
+| +0#0000e05&@1|#| |p|r|e| |"|s|t|r|i|n|g|"| |p|o|s|t| +0#0000000&@53
+|}+0#e000e06&| +0#0000000&@73
+@75
+|a+0#af5f00255&|u|t|o|c|m|d| +0#0000000&|B+0#00e0003&|u|f|N|e|w|F|i|l|e| +0#0000000&|*| |{+0#e000e06&| +0#0000000&@52
+| +0#0000e05&@1|#| |p|r|e| |"|s|t|r|i|n|g|"| |p|o|s|t| +0#0000000&@53
+@57|1|,|1| @10|T|o|p| 
new file mode 100644
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_no_comment_strings_99.dump
@@ -0,0 +1,20 @@
+|"+0#0000e05#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |l|e|t| |g|:|v|i|m|s|y|n|_|c|o|m@1|e|n|t|_|s|t|r|i|n|g|s| |=| |v|:|f|a|l|s|e| +0#0000000&@19
+@75
+|"+0#0000e05&| |p|r|e| |"|s|t|r|i|n|g|"| |p|o|s|t| +0#0000000&@55
+@75
+|f+0#af5f00255&|u|n|c|t|i|o|n| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&@60
+| +0#0000e05&@1|"| |p|r|e| |"|s|t|r|i|n|g|"| |p|o|s|t| +0#0000000&@53
+|e+0#af5f00255&|n|d|f|u|n|c|t|i|o|n| +0#0000000&@63
+@75
+|d+0#af5f00255&|e|f| +0#0000000&|B|a|r|(+0#e000e06&|)| +0#0000000&@65
+| +0#0000e05&@1|#| |p|r|e| |"|s|t|r|i|n|g|"| |p|o|s|t| +0#0000000&@53
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
+@75
+|c+0#af5f00255&|o|m@1|a|n|d| +0#0000000&|F|o@1| |{+0#e000e06&| +0#0000000&@61
+| +0#0000e05&@1|#| |p|r|e| |"|s|t|r|i|n|g|"| |p|o|s|t| +0#0000000&@53
+|}+0#e000e06&| +0#0000000&@73
+@75
+|a+0#af5f00255&|u|t|o|c|m|d| +0#0000000&|B+0#00e0003&|u|f|N|e|w|F|i|l|e| +0#0000000&|*| |{+0#e000e06&| +0#0000000&@52
+| +0#0000e05&@1|#| |p|r|e| |"|s|t|r|i|n|g|"| |p|o|s|t| +0#0000000&@53
+>}+0#e000e06&| +0#0000000&@73
+@57|2|0|,|1| @9|B|o|t| 
new file mode 100644
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim9_ex_comment_strings.vim
@@ -0,0 +1,22 @@
+vim9script
+
+# Vim comment strings
+# VIM_TEST_SETUP let g:vimsyn_comment_strings = v:true
+
+# pre "string" post
+
+function Foo()
+  " pre "string" post
+endfunction
+
+def Bar()
+  # pre "string" post
+enddef
+
+command Foo {
+  # pre "string" post
+}
+
+autocmd BufNewFile * {
+  # pre "string" post
+}
new file mode 100644
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim9_ex_no_comment_strings.vim
@@ -0,0 +1,22 @@
+vim9script
+
+# Vim comment strings
+# VIM_TEST_SETUP let g:vimsyn_comment_strings = v:false
+
+# pre "string" post
+
+function Foo()
+  " pre "string" post
+endfunction
+
+def Bar()
+  # pre "string" post
+enddef
+
+command Foo {
+  # pre "string" post
+}
+
+autocmd BufNewFile * {
+  # pre "string" post
+}
new file mode 100644
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim_ex_comment_strings.vim
@@ -0,0 +1,20 @@
+" Vim comment strings
+" VIM_TEST_SETUP let g:vimsyn_comment_strings = v:true
+
+" pre "string" post
+
+function Foo()
+  " pre "string" post
+endfunction
+
+def Bar()
+  # pre "string" post
+enddef
+
+command Foo {
+  # pre "string" post
+}
+
+autocmd BufNewFile * {
+  # pre "string" post
+}
new file mode 100644
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim_ex_no_comment_strings.vim
@@ -0,0 +1,20 @@
+" Vim comment strings
+" VIM_TEST_SETUP let g:vimsyn_comment_strings = v:false
+
+" pre "string" post
+
+function Foo()
+  " pre "string" post
+endfunction
+
+def Bar()
+  # pre "string" post
+enddef
+
+command Foo {
+  # pre "string" post
+}
+
+autocmd BufNewFile * {
+  # pre "string" post
+}
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -408,7 +408,9 @@ syn region	vimUserCmdBlock	contained	mat
 
 " Lower Priority Comments: after some vim commands... {{{2
 " =======================
-syn region	vimCommentString	contained oneline start='\S\s\+"'ms=e end='"'
+if get(g:, "vimsyn_comment_strings", 1)
+  syn region	vimCommentString	contained oneline start='\S\s\+"'ms=e end='"'
+endif
 
 if s:vim9script
   syn match	vimComment	excludenl +\s"[^\-:.%#=*].*$+lc=1	contains=@vimCommentGroup,vimCommentString contained