Disable comment auto-insertion


I am trying to prevent neovim from adding comment header when I’m editing a comment section.

Specifically, when I hit ‘A’+Enter on a comment line, I would very much like neovim not to insert anything on the new line.

I’ve searched the web and read what I believe to be the relevant sections of the doc, but nothing works.

Here’s what’s in my init.vim:

"prevent vim from doing things it wasn’t asked to
autocmd FileType * setlocal formatoptions-=
autocmd FileType * set formatoptions=
setlocal formatoptions=
set formatoptions=
set textwidth=0

Am I missing something or is this a bug?

Any help appreciated.

[EDIT]: it looks like setting formatoptions to nil is somehow overriden by something that loads when the filetype changes: after loading my file, the formatoptions have been replaced by croql (none of which are welcome)

You can find what changed an option with:

:verbose set formatoptions?

Hi Benoit,

Thanks for taking the time to answer.

I’ve tried your setting in my init.vim and I do now see the current value of formatoptions in the status line (which is indeed not what is specified in my init file so something overwrites my settins).

However, it’s only showing me the current value, not what overwrote it or when it was overwritten.

Any further clue would be very welcome.