覆盖vim中ftplugins设置的选项

Eve*_*ree 4 vim

我希望能够formatoptions为所有文件类型设置我自己的,但我似乎无法覆盖vim的默认"ftplugins".我把我的自定义formatoptions放入.vim/after/overrides,但这似乎没有覆盖任何东西.如果我运行:verbose set formatoptions?它告诉我设置该选项的最后一个文件是/usr/share/vim/vim74/ftplugin/vim.vim.内容.vim/after/overrides.vim如下.

" Format Options
set formatoptions=crnj
Run Code Online (Sandbox Code Playgroud)

Ing*_*kat 9

之后的目录树具有相同的结构作为一个下~/.vim/; 你.vim/after/overrides.vim永远不会被采购(检查:scriptnames).

您不能通过after目录一般覆盖所有文件类型插件,只能单独覆盖,例如Vimscript in .~/.vim/after/ftplugin/vim.vim

您可以使用a执行该泛型覆盖:autocmd Filetype * setlocal formatoptions=...,但必须在默认文件类型检测(即)之后进行定义:filetype plugin on.

你应该使用:setlocal而不是:set像ftplugins一样.