aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/ex_docmd.c2
-rw-r--r--test/functional/core/startup_spec.lua7
2 files changed, 8 insertions, 1 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 2142199c8a..b5a5a0f466 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -7330,7 +7330,7 @@ static void ex_filetype(exarg_T *eap)
break;
}
if (strcmp(arg, "on") == 0 || strcmp(arg, "detect") == 0) {
- if (*arg == 'o' || !filetype_detect) {
+ if (*arg == 'o' || filetype_detect != kTrue) {
source_runtime(FILETYPE_FILE, DIP_ALL);
filetype_detect = kTrue;
if (plugin) {
diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua
index 45f8294b16..8d6ba9712a 100644
--- a/test/functional/core/startup_spec.lua
+++ b/test/functional/core/startup_spec.lua
@@ -112,6 +112,13 @@ describe('startup', function()
|*2
]])
end)
+
+ it(':filetype detect enables filetype detection with -u NONE', function()
+ clear()
+ eq('filetype detection:OFF plugin:OFF indent:OFF', exec_capture('filetype'))
+ command('filetype detect')
+ eq('filetype detection:ON plugin:OFF indent:OFF', exec_capture('filetype'))
+ end)
end)
describe('startup', function()