我不明白为什么 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。请参阅帮助 cino-star
。
关于vim - 为什么 Vim 不能正确缩进长 C 风格的注释?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29700965/