If you found that the flag o
is being inserted back in formatoptions
after startup, you should find out why this is happening and fix it. This seems cleaner than always executing an autocmd
, even after the option is removed.
You could check where the option is set issuing with following commands:
:5verbose set fo?
:5verbose setl fo?
Edit:
If your problem is with a ftplugin
file that lies on Vim directory ($VIMRUNTIME/ftplugin
) you shouldn't change that file, because that change would be undone when Vim is updated. The proper way to change it is in your after
directory, as explained in :h after-directory
.
Supposing that the problem occurs with c
filetype, create file ~/.vim/after/ftplugin/c.vim
containing your setlocal formatoptions-=
commands.