Is there a way for me to configure my vimrc so that, when writing a multi-line comment in C++, Java, or other languages, like
/* f
 * o
 * o
 */
, I could get the asterisk and space to appear whenever I'm in a comment and press return to start a new line?
If I have not worded my question well enough, please tell me.
Thank you in advance for any help.
That is controlled via 'formatoptions':
:set formatoptions+=r
To also enable this for o and O commands:
:set formatoptions+=o
See all available options at :help fo-table.
Note that this depends on the correct 'comments' setting, but the default already has the right definition for /* ... */ multiline comments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With