mirror of
https://github.com/neovim/neovim.git
synced 2025-09-18 01:08:20 +00:00
defaults: do :filetype stuff unless explicitly "off"
Until now, the default `:filetype ...` setup was skipped if the user config touched `:filetype` in any way (including implicitly via `:syntax on`). No one needs that, and it's very confusing. Instead, proceed with `:filetype ... on` unless the user explicitly called `:filetype ... off`. closes #7765
This commit is contained in:
@@ -9718,17 +9718,18 @@ static void ex_filetype(exarg_T *eap)
|
||||
EMSG2(_(e_invarg2), arg);
|
||||
}
|
||||
|
||||
/// Do ":filetype plugin indent on" if user did not already do some
|
||||
/// permutation thereof.
|
||||
/// Set all :filetype options ON if user did not explicitly set any to OFF.
|
||||
void filetype_maybe_enable(void)
|
||||
{
|
||||
if (filetype_detect == kNone
|
||||
&& filetype_plugin == kNone
|
||||
&& filetype_indent == kNone) {
|
||||
if (filetype_detect == kNone) {
|
||||
source_runtime((char_u *)FILETYPE_FILE, true);
|
||||
filetype_detect = kTrue;
|
||||
}
|
||||
if (filetype_plugin == kNone) {
|
||||
source_runtime((char_u *)FTPLUGIN_FILE, true);
|
||||
filetype_plugin = kTrue;
|
||||
}
|
||||
if (filetype_indent == kNone) {
|
||||
source_runtime((char_u *)INDENT_FILE, true);
|
||||
filetype_indent = kTrue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user