commit 93347a67bf913c72ab2c1ba0aa4b26cc4ba6d1a8
parent 37952bf7b442cac794c4663f2e0123e7d72bc443
Author: zeertzjq <zeertzjq@outlook.com>
Date: Tue, 6 Aug 2024 22:20:26 +0800
fix(filetype): fix :filetype detect error with -u NONE (#29991)
:filetype detect should enable filetype detection when it hasn't been
enabled before.
Diffstat:
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git 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
@@ -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()