From 995ab8c3946bcf6ea6687be5d593fd6860e25d07 Mon Sep 17 00:00:00 2001 From: haya14busa Date: Sat, 17 Sep 2016 14:33:06 +0900 Subject: [PATCH] fix incorrect E477 #20 BANG should be allowed for user defined cmd --- autoload/vimlparser.vim | 2 +- test/test_command.ok | 5 +++++ test/test_command.vim | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 test/test_command.ok create mode 100644 test/test_command.vim diff --git a/autoload/vimlparser.vim b/autoload/vimlparser.vim index 1b35c6d..f5c8dd0 100644 --- a/autoload/vimlparser.vim +++ b/autoload/vimlparser.vim @@ -739,7 +739,7 @@ function! s:VimLParser.parse_command() let self.ea.forceit = 0 endif - if self.ea.cmd.flags !~# '\' && self.ea.forceit + if self.ea.cmd.flags !~# '\' && self.ea.forceit && self.ea.cmd.flags !~# 'USERCMD' throw s:Err('E477: No ! allowed', self.ea.cmdpos) endif diff --git a/test/test_command.ok b/test/test_command.ok new file mode 100644 index 0000000..415661e --- /dev/null +++ b/test/test_command.ok @@ -0,0 +1,5 @@ +; test_command +(excmd "normal! gg") +(excmd "normal gg") +(excmd "Usercmd x, y z 123") +(excmd "Usercmd! with bang") diff --git a/test/test_command.vim b/test/test_command.vim new file mode 100644 index 0000000..65d8eb4 --- /dev/null +++ b/test/test_command.vim @@ -0,0 +1,5 @@ +" test_command +normal! gg +normal gg +Usercmd x, y z 123 +Usercmd! with bang