Profiling Vim

what is vim doing? - start in verbose mode

vim -V filename

run vim with verbose 10 as default and write to messages

show with :messages

verbosity level

vim -V20/tmp/log filename

save verbose 20 to filename /tmp/log

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).

-> but no timestamps

change it on runtime

set verbosefile=/tmp/verbose.log
set verbose=15

vim startup

only on 7.2.269 or later

vim --startuptime /tmp/profile.log filename

vim has profile mode

XXX: needs vim to be compiled with +profile flag

profile start /tmp/log
profile func *
profile file *

-> written on vim close

vim --cmd 'profile start profile.log' --cmd 'profile func *' --cmd 'profile file *'

notes from help profile:

profile your syntax

only on 7.4

XXX: needs vim to be compiled with +profile flag

:syntime on :syntime report

insert timestamps

see: http://stackoverflow.com/questions/1687799/profiling-vim-startup-time

vim -V 2> >( ruby -n -e 'puts "#{Time.now.to_f}: #{$_}"' > /tmp/profile.log )

-> only working at the beginning tip is very old (2009) - maybe vim changed since then

fifo

-> work around: use fifo -> but vim closes the file -> use while loop

mkfifo ./startuptime
vim -V./startuptime

while true;  do cat startuptime | ruby -n  -e 'puts "#{Time.now.to_f}: #{$_}"' >> /tmp/vilog2; done