Suppose I have a comment block like this:
/**
* comment
* comment
* comment
*/
And when I open a new line inside this block I want vim to start it with
/**
* comment
* _
* comment
* comment
*/
but autoindent in standard (ubuntu) vim scripts starts an empty line, like this:
/**
* comment
_
* comment
* comment
*/
Is there a modified script or a command that would make vim do that (I remember a few years back I had this functionality, but can't google that right now)?
TIA.
You should add this to your .vimrc:
set formatoptions+=or
o Automatically insert the current comment leader after hitting 'o' or 'O' in Normal mode.
r Automatically insert the current comment leader after hitting <Enter> in Insert mode.
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