A change was made to the 'comments' setting in ftplugin/vim.vim at
commit 7ff78465f7057a672a6de0d75d56286da253501b (between 8.2.1175
and 8.2.1176) that introduced a change in formatting behavior that
I think is a bug.
The setting of the 'comments' option was changed from this:
setlocal com=sO:\"\ -,mO:\"\ \ ,eO:\"\",:\"
to this:
setlocal com=sO:\"\ -,mO:\"\ \ ,sO:#\ -,mO:#\ \ ,eO:##,:\",:#
It appears that the purpose was to add # as a comment leader for
Vim9, but the change also removed the end string of the original
three-piece comment definition for the " comment leader.
The problem this causes is that when entering a comment containing
an indented line that contains a ", the comment leader is not
automatically inserted at the start of the next line. Here is an
example, with 'filetype' set to "vim".
" When these lines are ended by pressing <Enter>,
" a " is automatically inserted at the start of
" each next line. This is good.
"
" This line is indented. Pressing <Enter> here
" also automatically starts this line with ".
But because of that second " in the line above, this line
did not start with a ". The comment was terminated. This
is bad.
The attached patch should fix the problem. The patch was made
against Vim 8.2.2519.
Regards,
Gary
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20210219233255.GC10301%40phoenix.
diff --git a/runtime/ftplugin/vim.vim b/runtime/ftplugin/vim.vim
index 5106e86ae..72eaca648 100644
--- a/runtime/ftplugin/vim.vim
+++ b/runtime/ftplugin/vim.vim
@@ -54,7 +54,7 @@ if "\n" .. getline(1, 10)->join("\n") =~# '\n\s*vim9\%[script]\>'
" Comments starts with # in Vim9 script
setlocal commentstring=#%s
else
- setlocal com=sO:\"\ -,mO:\"\ \ ,:\"
+ setlocal com=sO:\"\ -,mO:\"\ \ ,eO:\"\",:\"
" Comments starts with a double quote in legacy script
setlocal commentstring=\"%s
endif