patch 9.2.0726: filetype detect missing from completion
Commit:
https://github.com/vim/vim/commit/984f29860ed4e7259de932ca7a8027e650efae7a
Author: glepnir <
gleph...@gmail.com>
Date: Wed Jun 24 20:37:21 2026 +0000
patch 9.2.0726: filetype detect missing from completion
Problem: ":filetype detect" is a valid command but not offered by
command-line completion.
Solution: Add "detect" to the completion candidates (glepnir)
closes: #20625
Signed-off-by: glepnir <
gleph...@gmail.com>
Signed-off-by: Christian Brabandt <
c...@256bit.org>
diff --git a/src/cmdexpand.c b/src/cmdexpand.c
index 961ced577..bedcfdf36 100644
--- a/src/cmdexpand.c
+++ b/src/cmdexpand.c
@@ -3392,9 +3392,9 @@ get_filetypecmd_arg(expand_T *xp UNUSED, int idx)
if (idx < 0)
return NULL;
- if (filetype_expand_what == EXP_FILETYPECMD_ALL && idx < 4)
+ if (filetype_expand_what == EXP_FILETYPECMD_ALL && idx < 5)
{
- char *opts_all[] = {"indent", "plugin", "on", "off"};
+ char *opts_all[] = {"detect", "indent", "plugin", "on", "off"};
return (char_u *)opts_all[idx];
}
if (filetype_expand_what == EXP_FILETYPECMD_PLUGIN && idx < 3)
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index d1e20f6d2..9c34e8149 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -734,11 +734,13 @@ func Test_getcompletion()
call assert_equal([], l)
let l = getcompletion('', 'filetypecmd')
- call assert_equal(["indent", "off", "on", "plugin"], l)
+ call assert_equal(["detect", "indent", "off", "on", "plugin"], l)
let l = getcompletion('not', 'filetypecmd')
call assert_equal([], l)
let l = getcompletion('o', 'filetypecmd')
call assert_equal(['off', 'on'], l)
+ let l = getcompletion('det', 'filetypecmd')
+ call assert_equal(['detect'], l)
let l = getcompletion('tag', 'function')
call assert_true(index(l, 'taglist(') >= 0)
@@ -3635,7 +3637,9 @@ endfunc
func Test_completion_filetypecmd()
set wildoptions&
call feedkeys(":filetype \<C-A>\<C-B>\"\<CR>", 'tx')
- call assert_equal('"filetype indent off on plugin', @:)
+ call assert_equal('"filetype detect indent off on plugin', @:)
+ call feedkeys(":filetype det\<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"filetype detect', @:)
call feedkeys(":filetype plugin \<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"filetype plugin indent off on', @:)
call feedkeys(":filetype indent \<C-A>\<C-B>\"\<CR>", 'tx')
diff --git a/src/version.c b/src/version.c
index ed23c9f59..fb0e9f310 100644
--- a/src/version.c
+++ b/src/version.c
@@ -759,6 +759,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 726,
/**/
725,
/**/