aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-01-03 19:57:22 +0100
committerJustin M. Keyes <justinkz@gmail.com>2018-01-04 10:32:09 +0100
commit7c4bb23ff38a459911a742657572bc273e528ddf (patch)
tree684e61c5c18b202749496d5a25a4e66d40049261 /src
parentdc4a9cbe8564fa430bf600fe0dab5eba3a5e3292 (diff)
downloadrneovim-7c4bb23ff38a459911a742657572bc273e528ddf.tar.gz
rneovim-7c4bb23ff38a459911a742657572bc273e528ddf.tar.bz2
rneovim-7c4bb23ff38a459911a742657572bc273e528ddf.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_docmd.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index a0ede4f3c5..2fa8db6b82 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -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;
}