From: glepnir Date: Wed, 24 Jun 2026 20:37:21 +0000 (+0000) Subject: patch 9.2.0726: filetype detect missing from completion X-Git-Tag: v9.2.0726^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=984f29860ed4e7259de932ca7a8027e650efae7a;p=thirdparty%2Fvim.git 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 Signed-off-by: Christian Brabandt --- diff --git a/src/cmdexpand.c b/src/cmdexpand.c index 961ced5773..bedcfdf368 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 d1e20f6d29..9c34e81499 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 \\\"\", 'tx') - call assert_equal('"filetype indent off on plugin', @:) + call assert_equal('"filetype detect indent off on plugin', @:) + call feedkeys(":filetype det\\\"\", 'tx') + call assert_equal('"filetype detect', @:) call feedkeys(":filetype plugin \\\"\", 'tx') call assert_equal('"filetype plugin indent off on', @:) call feedkeys(":filetype indent \\\"\", 'tx') diff --git a/src/version.c b/src/version.c index ed23c9f597..fb0e9f310b 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, /**/