I'm having problems with slow startup time in vim. I used the --startuptime
flag to investigate, with the following output:
times in msec clock self+sourced self: sourced script clock elapsed: other lines000.003 000.003: --- VIM STARTING ---000.082 000.079: Allocated generic buffers000.103 000.021: locale set000.112 000.009: GUI prepared000.115 000.003: clipboard setup000.119 000.004: window checked000.496 000.377: inits 1000.513 000.017: parsing arguments000.514 000.001: expanding arguments000.527 000.013: shell init1000.786 1000.259: xsmp init1001.055 000.269: Termcap init1001.108 000.053: inits 21001.315 000.207: init highlight1001.702 000.298 000.298: sourcing /usr/share/vim/vim80/debian.vim1002.839 000.950 000.950: sourcing /usr/share/vim/vim80/syntax/syncolor.vim1002.954 001.139 000.189: sourcing /usr/share/vim/vim80/syntax/synload.vim1013.304 000.029 000.029: sourcing /home/daniel/.vim/ftdetect/tree.vim1013.520 010.526 010.497: sourcing /usr/share/vim/vim80/filetype.vim1013.594 011.841 000.176: sourcing /usr/share/vim/vim80/syntax/syntax.vim1013.642 012.296 000.157: sourcing $VIM/vimrc1014.184 000.410 000.410: sourcing /usr/share/vim/vim80/debian.vim1014.724 000.270 000.270: sourcing /home/daniel/.vim/bundle/Vundle.vim/autoload/vundle.vim1015.021 000.197 000.197: sourcing /home/daniel/.vim/bundle/Vundle.vim/autoload/vundle/config.vim1015.683 000.015 000.015: sourcing /usr/share/vim/vim80/filetype.vim1015.782 000.040 000.040: sourcing /usr/share/vim/vim80/ftplugin.vim1015.875 000.035 000.035: sourcing /usr/share/vim/vim80/indent.vim1016.281 000.298 000.298: sourcing /usr/share/vim/vim80/syntax/nosyntax.vim1016.592 000.211 000.211: sourcing /usr/share/vim/vim80/syntax/syncolor.vim1016.715 000.390 000.179: sourcing /usr/share/vim/vim80/syntax/synload.vim1016.744 000.796 000.108: sourcing /usr/share/vim/vim80/syntax/syntax.vim1016.810 000.011 000.011: sourcing /usr/share/vim/vim80/filetype.vim1016.875 000.009 000.009: sourcing /usr/share/vim/vim80/ftplugin.vim1016.937 000.009 000.009: sourcing /usr/share/vim/vim80/indent.vim1017.797 000.567 000.567: sourcing /usr/share/vim/vim80/pack/dist/opt/matchit/plugin/matchit.vim1017.906 000.013 000.013: sourcing /usr/share/vim/vim80/filetype.vim1018.017 000.011 000.011: sourcing /usr/share/vim/vim80/ftplugin.vim1018.085 000.010 000.010: sourcing /usr/share/vim/vim80/indent.vim1018.539 000.209 000.209: sourcing /usr/share/vim/vim80/syntax/syncolor.vim1019.006 000.203 000.203: sourcing /usr/share/vim/vim80/syntax/syncolor.vim1019.385 000.203 000.203: sourcing /usr/share/vim/vim80/syntax/syncolor.vim1020.619 002.482 001.867: sourcing /home/daniel/.vim/colors/minimalist.vim1020.903 000.207 000.207: sourcing /home/daniel/.vim/autoload/camelcasemotion.vim1021.384 007.678 002.596: sourcing ~/.vim/vimrc1021.387 000.098: sourcing vimrc file(s)1022.101 000.586 000.586: sourcing /home/daniel/.vim/plugin/camelcasemotion.vim1022.503 000.221 000.221: sourcing /home/daniel/.vim/autoload/ctrlp/mrufiles.vim1022.753 000.632 000.411: sourcing /home/daniel/.vim/plugin/ctrlp.vim1023.103 000.273 000.273: sourcing /home/daniel/.vim/bundle/tabular/plugin/Tabular.vim1023.450 000.090 000.090: sourcing /usr/share/vim/vim80/plugin/getscriptPlugin.vim1023.712 000.247 000.247: sourcing /usr/share/vim/vim80/plugin/gzip.vim1023.994 000.268 000.268: sourcing /usr/share/vim/vim80/plugin/logiPat.vim1024.023 000.013 000.013: sourcing /usr/share/vim/vim80/plugin/manpager.vim1024.263 000.229 000.229: sourcing /usr/share/vim/vim80/plugin/matchparen.vim1024.941 000.662 000.662: sourcing /usr/share/vim/vim80/plugin/netrwPlugin.vim1025.013 000.043 000.043: sourcing /usr/share/vim/vim80/plugin/rrhelper.vim1025.066 000.033 000.033: sourcing /usr/share/vim/vim80/plugin/spellfile.vim1025.286 000.202 000.202: sourcing /usr/share/vim/vim80/plugin/tarPlugin.vim1025.408 000.098 000.098: sourcing /usr/share/vim/vim80/plugin/tohtml.vim1025.658 000.231 000.231: sourcing /usr/share/vim/vim80/plugin/vimballPlugin.vim1025.937 000.246 000.246: sourcing /usr/share/vim/vim80/plugin/zipPlugin.vim1026.087 000.026 000.026: sourcing /usr/share/vim/vim80/pack/dist/opt/matchit/plugin/matchit.vim1026.105 000.839: loading plugins1026.146 000.041: loading packages1026.676 000.274 000.274: sourcing /home/daniel/.vim/bundle/tabular/autoload/tabular.vim1028.950 002.703 002.429: sourcing /home/daniel/.vim/bundle/tabular/after/plugin/TabularMaps.vim1028.955 000.106: loading after plugins1029.433 000.478: inits 31029.736 000.303: reading viminfo1031.466 001.730: setup clipboard1031.483 000.017: setting raw mode1031.490 000.007: start termcap1031.510 000.020: clearing screen1031.954 000.444: opening buffers1032.050 000.096: BufEnter autocommands1032.052 000.002: editing files in windows1032.146 000.094: VimEnter autocommands1032.148 000.002: before starting main loop1033.609 001.461: first screen update1033.613 000.004: --- VIM STARTED ---
The offending line is clearly 1000.786 1000.259: xsmp init
, which I believe indicates that vim is connecting to the X server.
Googling suggests that the only way to fix this is to recompile without xclip
. But people use the system clipboard all the time, and most of the issues raised about this kind of slow connection seem to be related to using vim remotely, which I am not doing. The fact the delay is so close to exactly one second also makes me suspicious of something silly that might be easily fixed.
So, what can I do to investigate how slowly X is initialising here?
Extra info: I have this issue when running vim with bash through both gnome-terminal and the simple terminal.