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

后端 未结 2 1041
不知归路
不知归路 2021-01-24 16:02

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.

相关标签:
2条回答
  • 2021-01-24 16:49

    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.)

    0 讨论(0)
  • 2021-01-24 16:58

    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
    
    0 讨论(0)
提交回复
热议问题