From: glepnir Date: Sun, 21 Jun 2026 12:55:58 +0000 (+0000) Subject: patch 9.2.0683: filetype completion mishandles finished sub options X-Git-Tag: v9.2.0683^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe65f23aca22c40d5e919aa0e4f2909bf57d8d94;p=thirdparty%2Fvim.git patch 9.2.0683: filetype completion mishandles finished sub options Problem: ":filetype plugin" gives "pluginindent" because a sub option before the cursor is treated as already given. Solution: only skip plugin and indent when followed by white space. (glepnir) closes: #20594 Signed-off-by: glepnir Signed-off-by: Christian Brabandt --- diff --git a/src/cmdexpand.c b/src/cmdexpand.c index 63b4921604..496ab7b883 100644 --- a/src/cmdexpand.c +++ b/src/cmdexpand.c @@ -2455,13 +2455,13 @@ set_context_in_filetype_cmd(expand_T *xp, char_u *arg) for (;;) { - if (STRNCMP(p, "plugin", 6) == 0) + if (STRNCMP(p, "plugin", 6) == 0 && VIM_ISWHITE(p[6])) { val |= EXPAND_FILETYPECMD_PLUGIN; p = skipwhite(p + 6); continue; } - if (STRNCMP(p, "indent", 6) == 0) + if (STRNCMP(p, "indent", 6) == 0 && VIM_ISWHITE(p[6])) { val |= EXPAND_FILETYPECMD_INDENT; p = skipwhite(p + 6); diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim index ad48c54ad5..d1e20f6d29 100644 --- a/src/testdir/test_cmdline.vim +++ b/src/testdir/test_cmdline.vim @@ -3648,6 +3648,10 @@ func Test_completion_filetypecmd() call assert_equal('"filetype off on', @:) call feedkeys(":filetype indent of\\\"\", 'tx') call assert_equal('"filetype indent off', @:) + call feedkeys(":filetype plugin\\\"\", 'tx') + call assert_equal('"filetype plugin', @:) + call feedkeys(":filetype plugin indent\\\"\", 'tx') + call assert_equal('"filetype plugin indent', @:) set wildoptions& endfunc diff --git a/src/version.c b/src/version.c index 4275dec4b8..fc1ecbce0d 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 */ +/**/ + 683, /**/ 682, /**/