启动时配置文件自动命令

时间:2018-02-04 22:31:58

标签: vim vim-plugin

每次我尝试在ViM中打开fugitive时,都需要很长时间(几秒钟)。

我试图通过--startuptime

对其进行分析
times in msec
 clock   self+sourced   self:  sourced script
 clock   elapsed:              other lines

000.004  000.004: --- VIM STARTING ---
000.074  000.070: Allocated generic buffers
000.123  000.049: locale set
000.133  000.010: GUI prepared
000.134  000.001: clipboard setup
000.138  000.004: window checked
000.445  000.307: inits 1
000.501  000.056: parsing arguments
000.504  000.003: expanding arguments
000.523  000.019: shell init
000.766  000.243: xsmp init
000.952  000.186: Termcap init
000.985  000.033: inits 2
001.736  000.751: init highlight
001.940  000.130  000.130: sourcing /usr/share/vim/vimfiles/archlinux.vim
001.966  000.204  000.074: sourcing /etc/vimrc
008.046  000.028  000.028: sourcing /usr/share/vim/vimfiles/ftdetect/dockerfile.vim
008.125  006.076  006.048: sourcing /usr/share/vim/vim80/filetype.vim
008.204  000.039  000.039: sourcing /usr/share/vim/vim80/ftplugin.vim
008.256  000.012  000.012: sourcing /usr/share/vim/vim80/filetype.vim
008.325  000.034  000.034: sourcing /usr/share/vim/vim80/indent.vim
008.749  000.199  000.199: sourcing /usr/share/vim/vim80/syntax/syncolor.vim
008.839  000.345  000.146: sourcing /usr/share/vim/vim80/syntax/synload.vim
008.870  000.431  000.086: sourcing /usr/share/vim/vim80/syntax/syntax.vim
009.378  000.166  000.166: sourcing /usr/share/vim/vim80/syntax/syncolor.vim
009.703  000.168  000.168: sourcing /usr/share/vim/vim80/syntax/syncolor.vim
009.963  000.164  000.164: sourcing /usr/share/vim/vim80/syntax/syncolor.vim
010.179  001.089  000.591: sourcing /usr/share/vim/vim80/colors/desert.vim
011.009  000.373  000.373: sourcing /usr/share/vim/vim80/ftoff.vim
011.492  000.198  000.198: sourcing /home/black/.vim/bundle/Vundle.vim/autoload/vundle.vim
011.759  000.186  000.186: sourcing /home/black/.vim/bundle/Vundle.vim/autoload/vundle/config.vim
024.711  000.037  000.037: sourcing /home/black/.vim/bundle/vim-markdown/ftdetect/markdown.vim
024.897  000.017  000.017: sourcing /home/black/.vim/bundle/hspec.vim/ftdetect/hspec.vim
024.982  000.026  000.026: sourcing /home/black/.vim/bundle/vim2hs/ftdetect/cabalconfig.vim
025.013  000.014  000.014: sourcing /home/black/.vim/bundle/vim2hs/ftdetect/heist.vim
025.043  000.014  000.014: sourcing /home/black/.vim/bundle/vim2hs/ftdetect/hsc.vim
025.072  000.014  000.014: sourcing /home/black/.vim/bundle/vim2hs/ftdetect/jmacro.vim
025.169  000.052  000.052: sourcing /home/black/.vim/bundle/vim-coffee-script/ftdetect/coffee.vim
025.236  000.021  000.021: sourcing /home/black/.vim/bundle/vim-json/ftdetect/json.vim
025.350  000.023  000.023: sourcing /home/black/.vim/bundle/fsharp-vim/ftdetect/fsharp.vim
025.449  000.023  000.023: sourcing /home/black/.vim/bundle/ultisnips/ftdetect/snippets.vim
025.591  000.022  000.022: sourcing /usr/share/vim/vimfiles/ftdetect/dockerfile.vim
026.028  006.530  006.267: sourcing /usr/share/vim/vim80/filetype.vim
026.456  000.014  000.014: sourcing /usr/share/vim/vim80/ftplugin.vim
026.865  000.012  000.012: sourcing /usr/share/vim/vim80/indent.vim
027.443  025.444  010.450: sourcing $HOME/.vimrc
027.448  000.064: sourcing vimrc file(s)
028.089  000.508  000.508: sourcing /home/black/.vim/bundle/vim-surround/plugin/surround.vim
029.034  000.875  000.875: sourcing /home/black/.vim/bundle/vim-abolish/plugin/abolish.vim
029.343  000.228  000.228: sourcing /home/black/.vim/bundle/vim-commentary/plugin/commentary.vim
040.770  011.279  011.279: sourcing /home/black/.vim/bundle/vim-smartinput/autoload/smartinput.vim
040.788  011.382  000.103: sourcing /home/black/.vim/bundle/vim-smartinput/plugin/smartinput.vim
043.390  002.529  002.529: sourcing /home/black/.vim/bundle/vim-unimpaired/plugin/unimpaired.vim
047.524  004.057  004.057: sourcing /home/black/.vim/bundle/vim-easymotion/plugin/EasyMotion.vim
048.013  000.393  000.393: sourcing /home/black/.vim/bundle/vim-endwise/plugin/endwise.vim
048.296  000.223  000.223: sourcing /home/black/.vim/bundle/sideways.vim/plugin/sideways.vim
048.500  000.137  000.137: sourcing /home/black/.vim/bundle/inline_edit.vim/plugin/inline_edit.vim
048.764  000.200  000.200: sourcing /home/black/.vim/bundle/splitjoin.vim/plugin/splitjoin.vim
049.126  000.188  000.188: sourcing /home/black/.vim/bundle/switch.vim/plugin/switch.vim
050.676  001.486  001.486: sourcing /home/black/.vim/bundle/vim-fixkey/plugin/fixkey.vim
050.816  000.037  000.037: sourcing /home/black/.vim/bundle/vim2hs/plugin/haskell_tags.vim
052.538  001.705  001.705: sourcing /home/black/.vim/bundle/vim2hs/plugin/hpaste.vim
052.643  000.087  000.087: sourcing /home/black/.vim/bundle/vim2hs/plugin/offside.vim
066.729  014.003  014.003: sourcing /home/black/.vim/bundle/targets.vim/plugin/targets.vim
067.438  000.292  000.292: sourcing /home/black/.vim/bundle/unite.vim/autoload/unite/custom.vim
067.547  000.644  000.352: sourcing /home/black/.vim/bundle/unite.vim/plugin/unite/bookmark.vim
067.680  000.114  000.114: sourcing /home/black/.vim/bundle/unite.vim/plugin/unite/buffer.vim
067.756  000.058  000.058: sourcing /home/black/.vim/bundle/unite.vim/plugin/unite/history_yank.vim
067.878  000.105  000.105: sourcing /home/black/.vim/bundle/unite.vim/plugin/unite/window.vim
068.143  000.247  000.247: sourcing /home/black/.vim/bundle/unite.vim/plugin/unite.vim
068.291  000.069  000.069: sourcing /home/black/.vim/bundle/unite-haskellimport/plugin/haskellimport.vim
068.424  000.070  000.070: sourcing /home/black/.vim/bundle/file-line/plugin/file_line.vim
071.601  003.117  003.117: sourcing /home/black/.vim/bundle/vim-fugitive/plugin/fugitive.vim
072.126  000.439  000.439: sourcing /home/black/.vim/bundle/vim-signify/plugin/signify.vim
072.584  000.128  000.128: sourcing /home/black/.vim/bundle/ale/autoload/ale.vim
073.530  000.028  000.028: sourcing /home/black/.vim/bundle/ale/autoload/ale/balloon.vim
073.999  001.813  001.657: sourcing /home/black/.vim/bundle/ale/plugin/ale.vim
074.658  000.576  000.576: sourcing /home/black/.vim/bundle/incsearch.vim/plugin/incsearch.vim
075.098  000.158  000.158: sourcing /home/black/.vim/bundle/vim-indent-guides/autoload/indent_guides.vim
075.525  000.800  000.642: sourcing /home/black/.vim/bundle/vim-indent-guides/plugin/indent_guides.vim
078.163  000.100  000.100: sourcing /home/black/.vim/bundle/ultisnips/autoload/UltiSnips/map_keys.vim
078.298  002.700  002.600: sourcing /home/black/.vim/bundle/ultisnips/plugin/UltiSnips.vim
078.414  000.050  000.050: sourcing /home/black/.vim/bundle/vim-snippets/plugin/vimsnippets.vim
078.872  000.389  000.389: sourcing /home/black/.vim/bundle/RootIgnore/plugin/RootIgnore.vim
079.863  000.927  000.927: sourcing /home/black/.vim/bundle/undotree/plugin/undotree.vim
080.735  000.496  000.496: sourcing /home/black/.vim/bundle/editorconfig-vim/plugin/editorconfig.vim
081.844  001.027  001.027: sourcing /home/black/.vim/bundle/fzf.vim/plugin/fzf.vim
082.339  000.436  000.436: sourcing /home/black/.vim/bundle/vim-qf/plugin/qf.vim
082.659  000.081  000.081: sourcing /usr/share/vim/vim80/plugin/getscriptPlugin.vim
082.872  000.195  000.195: sourcing /usr/share/vim/vim80/plugin/gzip.vim
083.118  000.228  000.228: sourcing /usr/share/vim/vim80/plugin/logiPat.vim
083.158  000.022  000.022: sourcing /usr/share/vim/vim80/plugin/manpager.vim
083.345  000.171  000.171: sourcing /usr/share/vim/vim80/plugin/matchparen.vim
084.072  000.706  000.706: sourcing /usr/share/vim/vim80/plugin/netrwPlugin.vim
084.145  000.041  000.041: sourcing /usr/share/vim/vim80/plugin/rrhelper.vim
084.207  000.036  000.036: sourcing /usr/share/vim/vim80/plugin/spellfile.vim
084.403  000.173  000.173: sourcing /usr/share/vim/vim80/plugin/tarPlugin.vim
084.536  000.105  000.105: sourcing /usr/share/vim/vim80/plugin/tohtml.vim
084.777  000.218  000.218: sourcing /usr/share/vim/vim80/plugin/vimballPlugin.vim
085.032  000.221  000.221: sourcing /usr/share/vim/vim80/plugin/zipPlugin.vim
085.702  000.571  000.571: sourcing /home/black/.fzf/plugin/fzf.vim
145.695  059.874  059.874: sourcing /home/black/.local/lib/python3.6/site-packages/powerline/bindings/vim/plugin/powerline.vim
145.708  003.503: loading plugins
145.775  000.067: loading packages
146.422  000.435  000.435: sourcing /home/black/.vim/bundle/indentLine/after/plugin/indentLine.vim
146.779  000.038  000.038: sourcing /home/black/.vim/bundle/vim2hs/autoload/vim2hs.vim
146.818  000.217  000.179: sourcing /home/black/.vim/bundle/vim2hs/after/plugin/tabular_haskell.vim
147.057  000.056  000.056: sourcing /home/black/.vim/bundle/ale/after/plugin/ale.vim
147.356  000.208  000.208: sourcing /home/black/.vim/bundle/ultisnips/after/plugin/UltiSnips_after.vim
147.522  000.013  000.013: sourcing /home/black/.vim/bundle/ale/after/plugin/ale.vim
147.526  000.822: loading after plugins
148.230  000.704: inits 3
148.789  000.559: reading viminfo
151.184  002.395: setup clipboard
151.202  000.018: setting raw mode
151.207  000.005: start termcap
151.243  000.036: clearing screen
155.673  000.040  000.040: sourcing /home/black/.vim/bundle/splitjoin.vim/ftplugin/vim/splitjoin.vim
156.705  000.408  000.408: sourcing /usr/share/vim/vim80/ftplugin/vim.vim
158.253  000.090  000.090: sourcing /usr/share/vim/vim80/indent/vim.vim
166.259  001.130  001.130: sourcing /usr/share/vim/vim80/syntax/lua.vim
169.180  000.458  000.458: sourcing /usr/share/vim/vim80/syntax/pod.vim
171.965  003.518  003.060: sourcing /usr/share/vim/vim80/syntax/perl.vim
177.434  003.261  003.261: sourcing /usr/share/vim/vim80/syntax/ruby.vim
178.288  000.714  000.714: sourcing /usr/share/vim/vim80/syntax/python.vim
179.655  020.609  011.986: sourcing /usr/share/vim/vim80/syntax/vim.vim
180.739  000.082  000.082: sourcing /home/black/.vim/bundle/ale/autoload/ale/events.vim
181.163  000.180  000.180: sourcing /home/black/.vim/bundle/ale/autoload/ale/util.vim
181.745  000.246  000.246: sourcing /home/black/.vim/bundle/ale/autoload/ale/linter.vim
182.548  000.386  000.386: sourcing /home/black/.vim/bundle/ale/ale_linters/vim/vint.vim
185.742  000.132  000.132: sourcing /home/black/.vim/bundle/vim-signify/autoload/sy.vim
186.083  000.074  000.074: sourcing /home/black/.vim/bundle/vim-signify/autoload/sy/util.vim
187.271  000.941  000.941: sourcing /home/black/.vim/bundle/vim-signify/autoload/sy/repo.vim
190.859  000.691  000.691: sourcing /home/black/.vim/bundle/ale/autoload/ale/engine.vim
191.915  000.586  000.586: sourcing /home/black/.vim/bundle/ale/autoload/ale/sign.vim
192.598  000.187  000.187: sourcing /home/black/.vim/bundle/ale/autoload/ale/list.vim
193.439  000.395  000.395: sourcing /home/black/.vim/bundle/ale/autoload/ale/highlight.vim
194.045  000.277  000.277: sourcing /home/black/.vim/bundle/ale/autoload/ale/cursor.vim
194.979  000.098  000.098: sourcing /home/black/.vim/bundle/unite.vim/autoload/unite/sources/buffer/variables.vim
197.347  020.682: opening buffers
197.599  000.252: BufEnter autocommands
197.602  000.003: editing files in windows
198.295  000.304  000.304: sourcing /home/black/.vim/bundle/vim-signify/autoload/sy/sign.vim
210.640  001.875  001.875: sourcing /usr/share/vim/vim80/syntax/lua.vim
211.620  000.528  000.528: sourcing /usr/share/vim/vim80/syntax/pod.vim
215.469  004.665  004.137: sourcing /usr/share/vim/vim80/syntax/perl.vim
218.827  003.211  003.211: sourcing /usr/share/vim/vim80/syntax/ruby.vim
219.629  000.658  000.658: sourcing /usr/share/vim/vim80/syntax/python.vim
220.815  020.514  010.105: sourcing /usr/share/vim/vim80/syntax/vim.vim
223.517  000.025  000.025: sourcing /home/black/.vim/bundle/splitjoin.vim/ftplugin/vim/splitjoin.vim
224.634  000.406  000.406: sourcing /usr/share/vim/vim80/ftplugin/vim.vim
226.109  000.032  000.032: sourcing /usr/share/vim/vim80/indent/vim.vim
237.652  001.692  001.692: sourcing /usr/share/vim/vim80/syntax/lua.vim
238.669  000.597  000.597: sourcing /usr/share/vim/vim80/syntax/pod.vim
242.450  004.652  004.055: sourcing /usr/share/vim/vim80/syntax/perl.vim
245.874  003.271  003.271: sourcing /usr/share/vim/vim80/syntax/ruby.vim
246.644  000.635  000.635: sourcing /usr/share/vim/vim80/syntax/python.vim
247.861  020.932  010.682: sourcing /usr/share/vim/vim80/syntax/vim.vim
1903.016  001.506  001.506: sourcing /usr/share/vim/vim80/syntax/lua.vim
1903.924  000.500  000.500: sourcing /usr/share/vim/vim80/syntax/pod.vim
1907.336  004.172  003.672: sourcing /usr/share/vim/vim80/syntax/perl.vim
1910.418  002.914  002.914: sourcing /usr/share/vim/vim80/syntax/ruby.vim
1911.183  000.624  000.624: sourcing /usr/share/vim/vim80/syntax/python.vim
1912.244  018.788  009.572: sourcing /usr/share/vim/vim80/syntax/vim.vim
1913.393  000.249  000.249: sourcing /home/black/.vim/bundle/vim-qf/autoload/qf.vim
3614.321  3355.469: VimEnter autocommands
3614.325  000.004: before starting main loop
3643.537  029.212: first screen update
3643.541  000.004: --- VIM STARTED ---

我认为重要的是这一行:

3614.321  3355.469: VimEnter autocommands

我曾尝试将时间测量添加到我拥有的插件中,而且我只能获得1-2秒。

所以我试图将它们全部删除,我仍然得到一个巨大的数字:

3112.104  1681.107: VimEnter autocommands

是否可以获得更精确的数字? 定时执行/跟踪将是最好的。

1 个答案:

答案 0 :(得分:0)

使用tweekmonster/startuptime(@ sudavid4建议)后,我得到了一些见解:

    1 Total Time:  288.812 -- Outstanding$                                                                                                                                                                                                 
    2 
    3 
    4 Slowest 10 plugins (out of 51)
    5     ¦   ¦   ¦   ¦  vim| 174.589
    6     ¦   ¦   ¦[runtime]| 21.277
    7     ¦   vim-unimpaired| 15.365
    8     ¦   ¦   ¦[unknown]| 14.710
    9     ¦   vim-smartinput| 12.924
   10   vim-textobj-keyvalue| 12.225
   11     ¦   vim-easymotion| 6.644
   12   vim-textobj-function| 3.136
   13 vim-textobj-methodcall| 2.918
   14    vim-textobj-comment| 2.595
   15 
   16 Phase Detail:
   17 
   18 init highlight (34.345)
   19 18.787    [runtime]
   20 |   15.468    /usr/share/vim/vim81/filetype.vim
   21 |   1.598     /usr/share/vim/vim81/syntax/syncolor.vim
   22 |   0.750     /usr/share/vim/vim81/colors/desert.vim
   23 |   0.548     /usr/share/vim/vim81/ftoff.vim
   24 |   0.192     /usr/share/vim/vim81/syntax/synload.vim
   25 |   0.106     /usr/share/vim/vim81/syntax/syntax.vim
   26 |   0.071     /usr/share/vim/vim81/ftplugin.vim
   27 |   0.056     /usr/share/vim/vim81/indent.vim

出现突出显示是这里的问题。