I'm editing my .vimrc file, and I am including comments. When I have a comment like this: example commentAnd then hit enter at the end of the line after finishing the comment, the next line is automatically set up as a comment (the quotes are automatically inserted): example comment How can I stop this behavior?
How can I get vim to stop putting comments in front of new lines?
formatting;comments
This is controlled with the formatoptions setting; from :help fo-table: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      readability.Note that the statement about the defaults is somewhat misleading, since many filetypes change the formatoptions to best suit the file type; for example in /usr/share/vim/vim74/ftplugin/vim.vim: Set 'formatoptions' to break comment lines but not other lines, and insert the comment leader when hitting <CR> or using o.setlocal fo-=t fo+=croqlYou can view the current formatoptions with::set fo?  formatoptions=jcroqlAnd see where they were set like so::verbose set fo?  formatoptions=jcroql      Last set from /usr/share/vim/vim74/ftplugin/vim.vimIn this case, you want to remove the r flag, but perhaps also the c and o flags:r       Automatically insert the current comment leader after hitting        <Enter> in Insert mode.c       Auto-wrap comments using textwidth, inserting the current comment        leader automatically.o       Automatically insert the current comment leader after hitting 'o' or        'O' in Normal mode.This can be done like so::set formatoptions-=r formatoptions-=c formatoptions-=oNote that using :set formatoptions-=cro won't work as expected (since it's a string, it will look for the string cro, in that order, which often won't work.).To set the changes only for the current buffer, use :setlocal instead of :set. If you want to always have these options, it's probably best to use an autocmd in your vimrc; for example:au FileType vim setlocal fo-=c fo-=r fo-=oThis will set the options only for the 'vim' filetype, and won't interfere with other filetypes.If you want to always set it, use:au FileType * set fo-=c fo-=r fo-=oJust using set fo-=cro won't work since many filetypes set/expand formatoption (like shown above); the FileType autocmd is executed after the filetype files have loaded.