From df65f87fd7711d4e8699a7625aa5435839c02d09 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 19 Jan 2026 10:41:23 +0800 Subject: [PATCH] vim-patch:partial:8.2.3149: some plugins have a problem with the error check Problem: Some plugins have a problem with the error check for using :command with -complete but without -nargs. Solution: In legacy script only give a warning message. https://github.com/vim/vim/commit/cc7eb2aa7a7f2e6ae41f1e7cf60965c083d8a9e9 Align tests with Vim only. Co-authored-by: Bram Moolenaar --- test/old/testdir/test_usercommands.vim | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/test/old/testdir/test_usercommands.vim b/test/old/testdir/test_usercommands.vim index d3f87ea924..9370cd021c 100644 --- a/test/old/testdir/test_usercommands.vim +++ b/test/old/testdir/test_usercommands.vim @@ -2,6 +2,7 @@ source check.vim source screendump.vim +source vim9.vim " Test for in user defined commands function Test_cmdmods() @@ -307,13 +308,26 @@ func Test_CmdErrors() call assert_fails('com! -complete=custom DoCmd :', 'E467:') call assert_fails('com! -complete=customlist DoCmd :', 'E467:') " call assert_fails('com! -complete=behave,CustomComplete DoCmd :', 'E468:') - call assert_fails('com! -complete=file DoCmd :', 'E1208:') - call assert_fails('com! -nargs=0 -complete=file DoCmd :', 'E1208:') call assert_fails('com! -nargs=x DoCmd :', 'E176:') call assert_fails('com! -count=1 -count=2 DoCmd :', 'E177:') call assert_fails('com! -count=x DoCmd :', 'E178:') call assert_fails('com! -range=x DoCmd :', 'E178:') + call assert_fails('com! -complete=file DoCmd :', 'E1208:') + call assert_fails('com! -nargs=0 -complete=file DoCmd :', 'E1208:') + + let lines =<< trim END + vim9script + com! -complete=file DoCmd : + END + call CheckScriptFailure(lines, 'E1208', 2) + + let lines =<< trim END + vim9script + com! -nargs=0 -complete=file DoCmd : + END + call CheckScriptFailure(lines, 'E1208', 2) + com! -nargs=0 DoCmd : call assert_fails('DoCmd x', 'E488:')