Reputation: 93
As the title says, are autocommands not triggering while executing an autocommand? For example, I have tested opening a new window with 'new' inside a VimEnter autocommand and it didn't trigger the WinNew autocommand. On the other hand, when I just put 'new' in the .vimrc file, it triggers the WinNew autocommand.
Upvotes: 2
Views: 265
Reputation: 27273
Quoting from autocmd.txt:
By default, autocommands do not nest. If you use "
:e
" or ":w
" in an autocommand, Vim does not execute theBufRead
andBufWrite
autocommands for those commands. If you do want this, use the "nested" flag for those commands in which you want nesting. For example:
:autocmd FileChangedShell *.c nested e!
The nesting is limited to 10 levels to get out of recursive loops.
Upvotes: 2