vim-patch:9.0.0370: cleaning up afterwards can make a function messy

Problem:    Cleaning up afterwards can make a function messy.
Solution:   Add the :defer command.

1d84f7608f

Omit EX_EXPR_ARG: Vim9 script only.
Make :def throw E319 to avoid confusing behavior.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq
2023-04-16 07:50:18 +08:00
parent 54dab9ed9e
commit b75634e55e
7 changed files with 275 additions and 73 deletions

View File

@@ -714,6 +714,18 @@ module.cmds = {
addr_type='ADDR_OTHER',
func='ex_debuggreedy',
},
{
command='def',
flags=bit.bor(EXTRA, BANG, SBOXOK, CMDWIN, LOCK_OK),
addr_type='ADDR_NONE',
func='ex_ni',
},
{
command='defer',
flags=bit.bor(NEEDARG, EXTRA, NOTRLCOM, CMDWIN, LOCK_OK),
addr_type='ADDR_NONE',
func='ex_call',
},
{
command='delcommand',
flags=bit.bor(BANG, NEEDARG, WORD1, TRLBAR, CMDWIN, LOCK_OK),