I want to be able to set my own formatoptions
for all filetypes, but I can't seem to get it to override Vim's default "ftplugins".
I put my custom formatoptions in .vim/after/overrides
, but that doesn't seem to override anything.
If I run :verbose set formatoptions?
it tells me that the last file to set that option was /usr/share/vim/vim74/ftplugin/vim.vim
.
The contents of .vim/after/overrides.vim
is:
" Format Options
set formatoptions=crnj
The after directory tree has the same structure as the one under ~/.vim/
; your .vim/after/overrides.vim
will never be sourced (check with :scriptnames
).
You can't generically override all filetype plugins with the after directory, only individually, e.g. for Vimscript in ~/.vim/after/ftplugin/vim.vim
.
You could do that generic override with an :autocmd Filetype * setlocal formatoptions=...
, but that would have to be defined after the default filetype detection (i.e. :filetype plugin on
).
You should use :setlocal
instead of :set
, just like in the ftplugins.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With