在vim中,我可以输入这样一行:
- When in the Course of human events it becomes necessary for one people
  to dissolve the political bands which have connected them with another
  ...
和vim将包装文本,使其与短划线的右侧对齐.但如果我用星号试试这个,那就是这样:
* When in the Course of human events it becomes necessary for one people
to dissolve the political bands which have connected them with another ...
有没有办法让自动加注器与领先的星号一起使用,就像它对领先的短划线一样?
DrA*_*rAl 11
这是使用comments设置完成的(请参阅:help 'comments'和:help format-comments).
您需要添加的设置fb:*,它说,存在与注释的开始类型*和*必须遵循的一个空白,只是在注释的第一行.Vim处理剩下的事情.但请注意,默认设置包含*在多行C注释的中间,因此您需要禁用此功能.
如果连字符前缀和带星号前缀的行是您想要像这样工作的唯一行,请执行以下操作:
set comments=fb:-,fb:*
或者,根据需要调整默认注释设置::set comments?显示当前设置并:help format-comments解释它的含义.
如果您希望它特定于文件类型,请在~/.vim/ftplugin(或vimfiles在Windows上)使用文件名创建文件extension.vim(例如,txt.vim对于.txt文件).在这个文件中:
setlocal comments=fb:-,fb:*
这将配置comments相关文件类型的设置,而不会影响其他文件.