lorecast162
lorecast162

Reputation: 13

Is there a way to disable automatic insertion of * characters in VIM multiline comments?

I come from Emacs and I am not used to (and don't like) seeing tons of * characters in my multiline comments, so how do I tell VIM to disable auto-insertion of them?

I want comments to be from this

/*
 *
 *
 */

to this

/*


*/

Thanks in advance =D

Upvotes: 1

Views: 319

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172570

This is described under :help format-comments. The * is a comment leader (as defined by the 'comments' option) and may be inserted based on the 'formatoptions' option, whose values are documented under :help fo-table. The following letters control comment leader insertion:

c Auto-wrap comments using textwidth, inserting the current comment leader automatically.
r Automatically insert the current comment leader after hitting in Insert mode.
o Automatically insert the current comment leader after hitting 'o' or 'O' in Normal mode.

So, to turn this off, use

:set fo-=c fo-=r fo-=o

(or short :set fo-=cro if they appear in that order).

As this option often is set by a filetype plugin (check via :verbose set fo?), you may need to override this (using :setlocal) in a file ~/.vim/after/ftplugin/{filetype}.vim to get rid of permanently.

Upvotes: 3

Related Questions