I like the autoformatting of comments when I'm writing them, however it's unusable because subsequent non-comment lines are always joined with the comment block.
Use of fo+=w helps a little bit, but if I accidentally leave Insert mode when there is a trailing space on the last line of my comment, it will join it with the next line regardless of whether the next line is a comment or not. This is really annoying and feels like incorrect behavior. It seems to me that autoformatting should never change or join a non-comment line into a comment line.
For example, I might have code like the following:
// FooBar does things.
func FooBar() {
return
}
If my formatoptions are
formatoptions=crqwn1ja
Then when I go to edit the comment, if I happen to leave a space at the end accidentally, then it is autoformatted into this:
// FooBar does things. func FooBar() {
return
}
If w isn't set then the space doesn't matter and it will always get formatted into that immediately.
Is this correct behavior? Is there a way to get vim to auto format comments but never join a non-comment line? Or should I just resign and not use the fo+=a option for code?