问题
In vim, the filetype occasionally is set to a value that auto-populates formatoptions with r and o, two features that I do not like. What setting can I add to guarantee that under no circumstances will those characters appear in formatoptions?
回答1:
Modifying @sergio's answer slightly, you could use
autocmd Filetype * set fo-=r fo-=o
in your vimrc.
This removes 'r' and 'o' from 'formatoptions' whenever the filetype is set.
(Note that filetype detection has to be on, which can be set by :filetype on.)
回答2:
You could define an auto-command in ~/.vimrc to remove r and o format options from every file type:
autocmd CmdLineLeave,BufEnter * set fo-=r fo-=o
来源:https://stackoverflow.com/questions/59277539/how-to-ensure-that-formatoptions-never-contains-r-or-o