1
0
forked from aniani/vim

patch 8.2.3271: Vim9: cannot use :command or :au with block in :def function

Problem:    Vim9: cannot use :command or :au with a block in a :def function.
Solution:   Recognize the start of the block.
This commit is contained in:
Bram Moolenaar
2021-08-01 21:19:43 +02:00
parent 0d4d9ee9bb
commit e4db17fb6e
7 changed files with 98 additions and 20 deletions

View File

@@ -334,6 +334,34 @@ def Test_block_local_vars_with_func()
CheckScriptSuccess(lines)
enddef
" legacy func for command that's defined later
func InvokeSomeCommand()
SomeCommand
endfunc
def Test_autocommand_block()
com SomeCommand {
g:someVar = 'some'
}
InvokeSomeCommand()
assert_equal('some', g:someVar)
delcommand SomeCommand
unlet g:someVar
enddef
def Test_command_block()
au BufNew *.xml {
g:otherVar = 'other'
}
split other.xml
assert_equal('other', g:otherVar)
bwipe!
au! BufNew *.xml
unlet g:otherVar
enddef
func g:NoSuchFunc()
echo 'none'
endfunc