How do I log all Vim verbose output to a file to diagnose slow startup or plugin issues?
Answer
:set verbosefile=/tmp/vim.log verbose=9
Explanation
Vim's verbosefile option redirects all verbose tracing output to a file on disk instead of printing it to the screen. Combined with verbose=9, every sourced file, option change, and function call is logged, making it invaluable for diagnosing slow startup, mapping conflicts, or unexpected behavior from plugins.
How it works
verbose=N— sets verbosity level (0 = silent, 1 = tracing basics, 9 = maximum detail)verbosefile={path}— writes verbose output to a file instead of the screen- Setting both before startup captures the entire session from the first script onward
To capture startup in particular, pass them as command-line arguments:
nvim --cmd 'set verbosefile=/tmp/vim.log verbose=9' myfile.txt
For Neovim, you can also use the --startuptime flag as an alternative for profiling startup time specifically.
Example
After running with the flags above, inspect the log:
$ head -30 /tmp/vim.log
sourcing /usr/share/nvim/runtime/filetype.lua
sourcing /home/user/.config/nvim/init.lua
calling plugin/telescope.lua
...
Tips
- Use
:set verbose=15for even more detail including everysetinvocation :messagesshows in-session messages but not startup output —verbosefilecaptures what:messagesmisses- After diagnosing, remember to unset:
:set verbosefile= verbose=0 - Pair with
:profile start /tmp/profile.logto see timing data alongside the trace