Format line with code and comments in vim

后端 未结 1 952
栀梦
栀梦 2021-02-14 20:12

Using the following settings

set textwidth=40
set fo? -> formatoptions=croql)
set comments?    -> comments=sO:* -,mO:*  ,exO:*/,s1:/*,mb:*,ex:*/,://
set ci         


        
1条回答
  •  礼貌的吻别
    2021-02-14 20:49

    I don't think it is. The comment formatting with 'comments' and 'formatoptions' only recognises when the comment string is at start-of-line. The comment starting in the middle of the line is only recognised by the syntax-highlighter, not the formatter. For this reason I don't think it's possible in Vim as shipped. You might be able to find a plugin to do it, but a cursory search on the Vim website didn't turn up anything useful.

    0 讨论(0)
提交回复
热议问题