重现我的问题:
$vim -u NONE test.cpp :set nocompatible :set tw=20 :set fo=croql
现在输入以下文字:
/* test test test test test test test test test */
请注意,包含测试的行上没有前导星号. Vim默认会插入它,删除它.
Vim应该自动包装它,但事实并非如此.
解决方法
使用我的
OnSyntaxChange plugin,您可以根据注释中的光标是否更改’fo’选项值:
call OnSyntaxChange#Install('Comment','^Comment$','a') autocmd User SyntaxCommentEntera setlocal fo+=t autocmd User SyntaxCommentLeaveA setlocal fo-=t