2015-04-17 85 views
2

我不明白爲什麼vim(Ubuntu 14.04 LTS上的7.4.52)縮進這樣的長C風格評論(見下文),而emacs縮進它。爲什麼Vim不能正確縮進C風格的註釋?

/* 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的錯誤嗎?

回答

2

要允許更多評論,你可以使用cinoptions這樣的來指定。set cinoptions+=*200。默認值是70.請參閱help cino-star

+0

非常感謝!在我的.vimrc中加入'cinoptions + = * 200',按預期工作:) – hdl