]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0726: filetype detect missing from completion v9.2.0726
authorglepnir <glephunter@gmail.com>
Wed, 24 Jun 2026 20:37:21 +0000 (20:37 +0000)
committerChristian Brabandt <cb@256bit.org>
Wed, 24 Jun 2026 20:37:21 +0000 (20:37 +0000)
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 <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/cmdexpand.c
src/testdir/test_cmdline.vim
src/version.c

index 961ced5773d60ba19fa259ea35e06cd7e03c11d5..bedcfdf368e5f45ef63b197f149f3a49f6d34b1e 100644 (file)
@@ -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)
index d1e20f6d2921bea5ae77b1fcbd7d7d08942f5781..9c34e81499305037394a43fe493f5e461a1ccea5 100644 (file)
@@ -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')
index ed23c9f597ada34db022d0a18fcc6c947705e1f8..fb0e9f310b176da71e17dc5d481c4bc7699b2e42 100644 (file)
@@ -759,6 +759,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    726,
 /**/
     725,
 /**/