# Can I disable continuation of comments to the next line in Vim

vim

In Vim, if I'm typing a comment in a code file, and I hit Enter, it automatically makes the newline a comment, too.

For instance, in a Ruby file:

# I manually typed the pound at the start of this line and hit enter.
# This line formatted itself this way automatically.


Generally, this is what I want, but not always. How can I temporarily turn off this auto-commenting behavior?

I think you're looking for

:set formatoptions-=cro

You can use the 'formatoptions' option  to influence how Vim formats text.
'formatoptions' is a string that can contain any of the letters below.  The
default setting is "tcq".  You can separate the option letters with commas for