If the autocmd has an obvious side effect, this is not too hard to tell; but sometimes the result is more subtle and it would be nice to just see "Hey, here's all the autocmds that ran on startup." I checked :history
but autocmds don't seem to show up there.
-
Mostly the same question on stack overflow: Is there a "vim runtime log"? - Stack Overflow– user202729Commented Oct 8, 2021 at 9:54
1 Answer
Vim's 'verbose'
option will give you this information. Set 'verbose'
to a large enough number to get the debug information you need.
'verbose' 'vbs' number (default 0)
global
{not in Vi, although some versions have a boolean
verbose option}
When bigger than zero, Vim will give messages about what it is doing.
Currently, these messages are given:
>= 1 When the viminfo file is read or written.
>= 2 When a file is ":source"'ed.
>= 5 Every searched tags file and include file.
>= 8 Files for which a group of autocommands is executed.
>= 9 Every executed autocommand.
>= 12 Every executed function.
>= 13 When an exception is thrown, caught, finished, or discarded.
>= 14 Anything pending in a ":finally" clause.
>= 15 Every executed Ex command (truncated at 200 characters).
This option can also be set with the "-V" argument. See |-V|.
This option is also set by the |:verbose| command.
When the 'verbosefile' option is set then the verbose messages are not
displayed.
Since you looking into autocommand's at startup, I would suggest you launch vim with the -V
('verbose'
) option and supply a 'verbosefile'
to write this debug data to a file (debug.log
). Then promptly close vim via +q
vim -V10debug.log +q
Now debug.log
will have lot's of Vim's startup information including autocommand events.
For more information see:
:h -V
:h 'verbose'
:h 'verbosefile'