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?
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/1535d76b-7031-41ba-ad81-5e328f61f7f0n%40googlegroups.com.
No comments:
Post a Comment