]> git.ipfire.org Git - thirdparty/vim.git/commit
patch 9.2.0908: cannot use a {} block in a nested :autocmd v9.2.0908
authorHirohito Higashi <h.east.727@gmail.com>
Tue, 4 Aug 2026 19:50:18 +0000 (19:50 +0000)
committerChristian Brabandt <cb@256bit.org>
Tue, 4 Aug 2026 19:50:18 +0000 (19:50 +0000)
commit284d1b51230a577e3736f2b7a2dabc03e04d2733
tree11f3298dc5e821c99d6cfcde4da8cd60b784955d
parentf620c3001891e6f0abb1c97932af94d021c4e9a0
patch 9.2.0908: cannot use a {} block in a nested :autocmd

Problem:  At script level a "{" block is only recognized when it is the
          whole argument of :autocmd or :command, so an :autocmd that is
          the command of another :autocmd cannot use a block.  In a :def
          function a trailing "{" is accepted instead, and there any
          command ending in "{", such as "normal! {", is mistaken for the
          start of a block (lacygoill).
Solution: Locate the block by following the argument of the command,
          descending into a nested :autocmd or :command, and use that
          everywhere a block needs to be recognized (Hirohito Higashi).

fixes:  #20918
closes: #20933

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
12 files changed:
runtime/doc/autocmd.txt
src/autocmd.c
src/ex_docmd.c
src/proto/autocmd.pro
src/proto/ex_docmd.pro
src/testdir/test_autocmd.vim
src/testdir/test_usercommands.vim
src/testdir/test_vim9_script.vim
src/usercmd.c
src/userfunc.c
src/version.c
src/vim9cmds.c