diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c index 439c1217f0..960f1ef9f5 100644 --- a/src/nvim/cmdexpand.c +++ b/src/nvim/cmdexpand.c @@ -1957,12 +1957,12 @@ static const char *set_context_in_filetype_cmd(expand_T *xp, const char *arg) int val = 0; while (true) { - if (strncmp(p, "plugin", 6) == 0) { + if (strncmp(p, "plugin", 6) == 0 && ascii_iswhite(p[6])) { val |= EXPAND_FILETYPECMD_PLUGIN; p = skipwhite(p + 6); continue; } - if (strncmp(p, "indent", 6) == 0) { + if (strncmp(p, "indent", 6) == 0 && ascii_iswhite(p[6])) { val |= EXPAND_FILETYPECMD_INDENT; p = skipwhite(p + 6); continue; diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim index a0c887347f..6dd7543a2f 100644 --- a/test/old/testdir/test_cmdline.vim +++ b/test/old/testdir/test_cmdline.vim @@ -3585,6 +3585,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