为什么Vim没有正确缩进长C风格的注释?

时间:2015-04-17 13:43:06

标签: vim

我无法理解为什么vim(Ubuntu 14.04 LTS上的7.4.52)缩进这样的长C风格评论(见下文),而emacs缩进它。

/* looong comment
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
* <- wrong indentation begins at comment line 72
* and keeps being wrong until the end of comment
*/

/*
 * <- back to normal until line 72
 */

FWIW,:setl告诉我的是:

  autoindent          cryptmethod=        expandtab           include=          nomodeline            shiftwidth=4        tags=
--autoread            define=             filetype=c          keywordprg=         path=               softtabstop=4
  cindent             errorformat=        grepprg=            makeprg=            scroll=22           syntax=c
  cinoptions=:0,(0,u0,U0
  comments=sO:* -,mO:*  ,exO:*/,s1:/*,mb:*,ex:*/,://
  fileencoding=utf-8
  formatoptions=croql
  omnifunc=ccomplete#Complete

知道为什么或如何纠正这种行为?这是Vim的错误吗?

1 个答案:

答案 0 :(得分:2)

要允许更长时间的评论,您可以使用cinoptions这样指定:set cinoptions+=*200。默认值为70.请参阅help cino-star