我注意到Vim打开Ruby和ERB(嵌入式Ruby)文件需要很长时间。我对我的启动时间进行了分析,以下是有趣的行(如果您想查看完整的分析,请查看底部):
32980.181 32011.917 32011.917: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/ftplugin/ruby.vim
32980.516 32035.414 022.871: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/ftplugin/eruby.vim
你可以看到,加载Ruby和ERuby的ftdetect需要很长时间(显然以"msec"为单位)。与此相比,加载HTML的ftdetect以及加载我的.vimrc所需的时间如何:
952.223 000.626 000.626: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/ftplugin/html.vim
738.536 612.248 534.785: sourcing $HOME/.vimrc
这是正常现象吗?我能做些什么来解决吗?打开一个文件需要等待大约33秒,这真的很令人恼火。
times in msec
clock self+sourced self: sourced script
clock elapsed: other lines
000.022 000.022: --- VIM STARTING ---
012.064 012.042: Allocated generic buffers
012.910 000.846: locale set
013.186 000.276: clipboard setup
013.203 000.017: window checked
033.918 020.715: inits 1
034.697 000.779: parsing arguments
034.716 000.019: expanding arguments
077.784 043.068: shell init
079.520 001.736: Termcap init
079.562 000.042: inits 2
080.186 000.624: init highlight
179.889 001.991 001.991: sourcing /Users/davidtuite/.vim/autoload/pathogen.vim
564.261 000.178 000.178: sourcing /Users/davidtuite/.vim/filetype.vim
632.475 000.389 000.389: sourcing /Users/davidtuite/.vim/bundle/jst/ftdetect/jst.vim
633.141 055.478 055.089: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/filetype.vim
660.587 000.236 000.236: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/ftplugin.vim
661.081 000.247 000.247: sourcing /Users/davidtuite/.vim/filetype.vim
661.408 000.041 000.041: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/filetype.vim
673.005 000.208 000.208: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/indent.vim
699.170 000.901 000.901: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/syntax/syncolor.vim
699.550 007.236 006.335: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/syntax/synload.vim
699.669 008.305 001.069: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/syntax/syntax.vim
700.763 000.561 000.561: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/syntax/syncolor.vim
715.774 000.497 000.497: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/syntax/syncolor.vim
716.658 000.452 000.452: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/syntax/syncolor.vim
722.467 010.218 009.269: sourcing /Users/davidtuite/.vim/bundle/solarized/colors/solarized.vim
738.536 612.248 534.785: sourcing $HOME/.vimrc
738.593 046.159: sourcing vimrc file(s)
784.522 000.859 000.859: sourcing /Users/davidtuite/.vim/bundle/ctrlp/autoload/ctrlp/mrufiles.vim
785.378 045.922 045.063: sourcing /Users/davidtuite/.vim/bundle/ctrlp/plugin/ctrlp.vim
816.261 000.454 000.454: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/plugin/getscriptPlugin.vim
818.593 000.792 000.792: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/plugin/gzip.vim
820.050 000.921 000.921: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/plugin/matchparen.vim
830.405 002.463 002.463: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/plugin/netrwPlugin.vim
843.038 000.145 000.145: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/plugin/rrhelper.vim
850.425 000.293 000.293: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/plugin/spellfile.vim
851.617 000.671 000.671: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/plugin/tarPlugin.vim
852.558 000.509 000.509: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/plugin/tohtml.vim
853.470 000.599 000.599: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/plugin/vimballPlugin.vim
854.255 000.463 000.463: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/plugin/zipPlugin.vim
854.362 062.537: loading plugins
854.375 000.013: inits 3
875.931 021.556: reading viminfo
875.995 000.064: setting raw mode
876.010 000.015: start termcap
876.062 000.052: clearing screen
952.223 000.626 000.626: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/ftplugin/html.vim
32980.181 32011.917 32011.917: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/ftplugin/ruby.vim
32980.516 32035.414 022.871: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/ftplugin/eruby.vim
33007.912 000.688 000.688: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/indent/ruby.vim
33024.997 001.804 001.804: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/indent/html.vim
33025.207 025.843 023.351: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/indent/eruby.vim
33067.541 000.929 000.929: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/syntax/javascript.vim
33085.205 004.486 004.486: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/syntax/vb.vim
33088.445 002.575 002.575: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/syntax/css.vim
33089.314 039.262 031.272: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/syntax/html.vim
33106.920 003.463 003.463: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/syntax/ruby.vim
33107.112 064.122 021.397: sourcing /usr/local/Cellar/vim/7.3.266/share/vim/vim73/syntax/eruby.vim
33107.888 107.447: opening buffers
33108.114 000.226: BufEnter autocommands
33108.117 000.003: editing files in windows
33108.319 000.202: VimEnter autocommands
33108.320 000.001: before starting main loop
33127.031 018.711: first screen update
33127.033 000.002: --- VIM STARTED ---