You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
vim does not run filetype plugin indent on and syntax on by default
Operating system/version: Arch Linux
Terminal name/version: any
$TERM: any
Actual behaviour
Since recently, neovim enables filetypes and syntax by default. Following HEAD states that users can simply delete those lines from their configuration. However, if the user removes filetype plugin indent on from their configuration, autocmd FileType lines in init.vim may no longer override settings applied by a filetype plugin. For example, autocmd FileType * setlocal formatoptions-=ro does not override formatoptions applied by a filetype plugin unless filetype plugin indent on has already been run before the autocommand is defined. The new syntax/filetype default is applied by neovim after init.vim, so if filetype plugin indent on is removed from init.vim, affected autocommands will not work as expected.
Expected behaviour
User configurations should continue to work as expected, or documentation should be updated to inform users how to update their init.vim.
Steps to reproduce using nvim -u NORC
This issue depends on a minimal init.vim, so here are two:
This is an example of a working config before neovim supported enabling syntax/filetypes by default:
This next config is an example of a user following the documentation and removing the filetype line, which is assumed to be redundant with the new default:
Confirmed. The old behavior accidentally works because users "probably" call :filetype plugin indent onbefore setting up autocmds. So the user's autocmds run after the :filetype autocmds.
Workaround 1:
A workaround is to setup the FileType handler on VimEnter:
au VimEnter * au FileType * setlocal formatoptions-=ro
However that workaround doesn't work for files loaded from the command line (nvim file1 file2 ...), because VimEnter happens after those files are loaded. :edit on the buffer fixes it.
Workaround 2:
Things should work just fine if you put filetype plugin indent on in your init.vim as you would in Vim. Nvim's auto-enable logic will be skipped in that case.
filetype plugin indent on
andsyntax on
by default$TERM
: anyActual behaviour
Since recently, neovim enables filetypes and syntax by default. Following HEAD states that users can simply delete those lines from their configuration. However, if the user removes
filetype plugin indent on
from their configuration,autocmd FileType
lines ininit.vim
may no longer override settings applied by a filetype plugin. For example,autocmd FileType * setlocal formatoptions-=ro
does not overrideformatoptions
applied by a filetype plugin unlessfiletype plugin indent on
has already been run before the autocommand is defined. The new syntax/filetype default is applied by neovim after init.vim, so iffiletype plugin indent on
is removed frominit.vim
, affected autocommands will not work as expected.Expected behaviour
User configurations should continue to work as expected, or documentation should be updated to inform users how to update their
init.vim
.Steps to reproduce using
nvim -u NORC
This issue depends on a minimal
init.vim
, so here are two:This is an example of a working config before neovim supported enabling syntax/filetypes by default:
This next config is an example of a user following the documentation and removing the
filetype
line, which is assumed to be redundant with the new default:We also need a file that will trigger an
ftplugin
which setsformatoptions
:Now we are ready:
You should see
formatoptions=jcql
. This is the expected behavior;ro
options have been removed by the autocommand.You should see
formatoptions=jcroql
. Thero
options have not been removed by the autocommand.The text was updated successfully, but these errors were encountered: