How to ensure that formatoptions *never* contains `r` or `o`?

帅比萌擦擦* 提交于 2020-01-21 19:17:57

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!