aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/main.c
diff options
context:
space:
mode:
authorGregory Anders <8965202+gpanders@users.noreply.github.com>2022-01-18 12:46:41 -0700
committerGitHub <noreply@github.com>2022-01-18 12:46:41 -0700
commitde6f9233eee937139f607d3a59fd5b1f479d8a13 (patch)
treebd63fb4dd40f7bfc81fc6738b1d1394cd84ecc27 /src/nvim/main.c
parentfcf5dd34fdfde3a6632b96a88f66c1053cba08d1 (diff)
downloadrneovim-de6f9233eee937139f607d3a59fd5b1f479d8a13.tar.gz
rneovim-de6f9233eee937139f607d3a59fd5b1f479d8a13.tar.bz2
rneovim-de6f9233eee937139f607d3a59fd5b1f479d8a13.zip
refactor: source ftplugin.vim separately from filetype.vim (#17129)
This is a follow-on to #17040. The real benefit of #17040 was ensuring that the ftplugin FileType autocommand was defined first and thus always fired first. A side effect of the implementation in #17040 was that setting variables that modified the state of filetype detection (such as g:did_load_filetypes or g:do_filetype_lua) could no longer be set in the user's init file. Filetype detection can also no longer be prevented from loading by using `:filetype off`. This PR addresses both of those side effects by unconditionally sourcing ftplugin.vim and indent.vim before the user's init file (which ensures that these autocommands run first) and sourcing filetype.vim *after* the user's init file (thus allowing it to be blocked or modified).
Diffstat (limited to 'src/nvim/main.c')
-rw-r--r--src/nvim/main.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 9d1c2ad834..748f5098fd 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -354,10 +354,10 @@ int main(int argc, char **argv)
exe_pre_commands(&params);
if (!vimrc_none) {
- // Does ":filetype plugin indent on". We do this *before* the user startup scripts to ensure
+ // Sources ftplugin.vim and indent.vim. We do this *before* the user startup scripts to ensure
// ftplugins run before FileType autocommands defined in the init file (which allows those
// autocommands to overwrite settings from ftplugins).
- filetype_maybe_enable();
+ filetype_plugin_enable();
}
// Source startup scripts.
@@ -365,6 +365,9 @@ int main(int argc, char **argv)
// If using the runtime (-u is not NONE), enable syntax & filetype plugins.
if (!vimrc_none) {
+ // Sources filetype.lua and filetype.vim unless the user explicitly disabled it with :filetype
+ // off.
+ filetype_maybe_enable();
// Sources syntax/syntax.vim. We do this *after* the user startup scripts so that users can
// disable syntax highlighting with `:syntax off` if they wish.
syn_maybe_enable();