为什么 Vim 不能正确缩进长 C 风格的注释?
Why doesn't Vim indent correctly long C style comments?
我不明白为什么 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 错误吗?
要允许更长的评论,您可以用 cinoptions
指定,如下所示:set cinoptions+=*200
。默认值为 70。请参阅 help cino-star
。
我不明白为什么 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 错误吗?
要允许更长的评论,您可以用 cinoptions
指定,如下所示:set cinoptions+=*200
。默认值为 70。请参阅 help cino-star
。