3

I am facing huge slowness when i start the neovim for the first time in a session, and then next time i open it the startup time is little better relatively but not as fast as vim is. I looked at the issue tracker on official neovim git repo as well but couldn't find any solution for my problem.

So i profiled it a bit using startuptime and below are the log files.

1st time startup

 times in msec
  clock   self+sourced   self:  sourced script
  clock   elapsed:              other lines

 000.009  000.009: --- NVIM STARTING ---
 009.986  009.977: locale set
 018.750  008.764: inits 1
 018.764  000.014: window checked
 018.842  000.078: parsing arguments
 020.031  001.189: expanding arguments
 020.081  000.051: inits 2
 020.591  000.510: init highlight
 2162.962  446.040  446.040: sourcing /apps/nttech/rbhanot/.config/nvim/autoload/plug.vim
 4363.032  265.956  265.956: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/filetype.vim
 4374.207  000.761  000.761: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/ftplugin.vim
 4384.176  000.624  000.624: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/indent.vim
 4511.851  000.251  000.251: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/syntax/syncolor.vim
 4559.538  048.912  048.661: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/syntax/synload.vim
 4559.623  174.580  125.668: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/syntax/syntax.vim
 4719.856  019.373  019.373: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/deoplete.nvim/autoload/deoplete/custom.vim
 4818.131  095.671  095.671: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/deoplete.nvim/autoload/deoplete/util.vim
 4865.563  044.503  044.503: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/deoplete.nvim/autoload/deoplete/init.vim
 5553.428  086.264  086.264: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neomake/autoload/neomake/configure.vim
 5625.453  068.322  068.322: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neomake/autoload/neomake/config.vim
 5766.744  138.128  138.128: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neomake/autoload/neomake/log.vim
 5880.082  023.316  023.316: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neomake/autoload/neomake/core.vim
 5880.362  110.428  087.112: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neomake/autoload/neomake/utils.vim
 5881.801  4591.203  3140.554: sourcing /apps/nttech/rbhanot/.config/nvim/plugins.vim
 6131.604  000.196  000.196: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/syntax/syncolor.vim
 6131.941  246.633  246.437: sourcing /apps/nttech/rbhanot/.config/nvim/settings.vim
 8233.645  2099.276  2099.276: sourcing /apps/nttech/rbhanot/.config/nvim/mappings.vim
 8667.321  000.210  000.210: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/syntax/syncolor.vim
 8667.962  000.184  000.184: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/syntax/syncolor.vim
 9128.201  057.730  057.730: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/onedark.vim/autoload/onedark.vim
 9143.354  893.845  835.721: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/onedark.vim/colors/onedark.vim
 9143.363  906.383  012.538: sourcing /apps/nttech/rbhanot/.config/nvim/colors.vim
 9143.367  9112.849  1269.354: sourcing /apps/nttech/rbhanot/.config/nvim/init.vim
 9143.370  009.931: sourcing vimrc file(s)
 9500.542  168.125  168.125: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/deoplete.nvim/autoload/deoplete.vim
 9500.640  248.886  080.761: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/deoplete.nvim/plugin/deoplete.vim
 9837.148  000.064  000.064: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/filetype.vim
 9837.393  000.032  000.032: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/ftplugin.vim
 9837.551  314.860  314.764: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/jedi-vim/plugin/jedi.vim
 10110.528  254.186  254.186: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/nerdcommenter/plugin/NERD_commenter.vim
 10327.254  138.892  138.892: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/ctrlp.vim/autoload/ctrlp/mrufiles.vim
 10327.400  178.883  039.991: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/ctrlp.vim/plugin/ctrlp.vim
 10448.190  101.616  101.616: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neoformat/plugin/neoformat.vim
 10758.798  197.868  197.868: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neomake/plugin/neomake.vim
 10846.685  065.937  065.937: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/vim-highlightedyank/plugin/highlightedyank.vim
 12296.180  830.588  830.588: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/lightline.vim/plugin/lightline.vim
 12300.560  002.324  002.324: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/gzip.vim
 12300.621  000.021  000.021: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/health.vim
 12300.702  000.055  000.055: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/man.vim
 12301.157  000.429  000.429: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/matchit.vim
 12301.336  000.151  000.151: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/matchparen.vim
 12301.754  000.390  000.390: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/netrwPlugin.vim
 12710.640  002.290  002.290: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/autoload/remote/host.vim
 12711.174  000.242  000.242: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/autoload/remote/define.vim
 12711.269  407.030  404.497: sourcing /apps/nttech/rbhanot/.local/share/nvim/rplugin.vim
 12711.279  409.492  002.462: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/rplugin.vim
 12711.429  000.110  000.110: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/rrhelper.vim
12711.642  000.151  000.151: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/shada.vim
12711.741  000.065  000.065: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/spellfile.vim
12711.919  000.144  000.144: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/tarPlugin.vim
12712.068  000.100  000.100: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/tohtml.vim
12712.151  000.033  000.033: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/tutor.vim
12712.329  000.149  000.149: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/zipPlugin.vim
12712.341  962.533: loading plugins
12712.501  000.161: loading packages
12713.280  000.779: loading after plugins
12713.289  000.008: inits 3
13329.357  616.069: reading ShaDa
13330.852  001.494: clearing screen
13471.229  132.012  132.012: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neomake/autoload/neomake.vim
13522.013  048.045  048.045: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neomake/autoload/neomake/compat.vim
13614.739  083.898  083.898: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/lightline.vim/autoload/lightline.vim
13726.571  100.799  100.799: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/lightline.vim/autoload/lightline/tab.vim
14180.150  201.807  201.807: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/lightline.vim/autoload/lightline/colorscheme.vim
14180.879  324.479  122.672: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/onedark.vim/autoload/lightline/colorscheme/onedark.vim
14183.512  163.427: opening buffers
14183.638  000.127: BufEnter autocommands
14183.641  000.003: editing files in windows
14194.265  002.221  002.221: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/autoload/provider/pythonx.vim
14194.736  000.253  000.253: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/autoload/provider/python3.vim
14201.950  000.095  000.095: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/autoload/provider.vim
24842.491  422.066  422.066: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/deoplete.nvim/autoload/deoplete/mapping.vim
25118.676  265.119  265.119: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/deoplete.nvim/autoload/deoplete/handler.vim
25119.092  10245.697: VimEnter autocommands
25122.433  003.006  003.006: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/autoload/provider/clipboard.vim
25122.454  000.356: before starting main loop
25123.773  001.319: first screen update
25123.776  000.003: --- NVIM STARTED ---

3rd/4th time startup of nvim

times in msec
 clock   self+sourced   self:  sourced script
 clock   elapsed:              other lines

000.008  000.008: --- NVIM STARTING ---
008.448  008.441: locale set
015.910  007.461: inits 1
015.921  000.012: window checked
016.028  000.107: parsing arguments
016.109  000.081: expanding arguments
016.152  000.043: inits 2
016.650  000.498: init highlight
026.381  001.913  001.913: sourcing /apps/nttech/rbhanot/.config/nvim/autoload/plug.vim
044.812  005.863  005.863: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/filetype.vim
045.537  000.476  000.476: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/ftplugin.vim
046.166  000.472  000.472: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/indent.vim
048.404  000.243  000.243: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/syntax/syncolor.vim
049.201  001.197  000.954: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/syntax/synload.vim
049.233  002.965  001.768: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/syntax/syntax.vim
053.277  000.102  000.102: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/deoplete.nvim/autoload/deoplete/custom.vim
055.590  000.149  000.149: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/deoplete.nvim/autoload/deoplete/util.vim
057.983  000.177  000.177: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/deoplete.nvim/autoload/deoplete/init.vim
064.724  000.342  000.342: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neomake/autoload/neomake/configure.vim
067.375  000.141  000.141: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neomake/autoload/neomake/config.vim
070.249  000.138  000.138: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neomake/autoload/neomake/log.vim
075.618  000.084  000.084: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neomake/autoload/neomake/core.vim
075.902  002.931  002.846: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neomake/autoload/neomake/utils.vim
076.079  052.397  036.729: sourcing /apps/nttech/rbhanot/.config/nvim/plugins.vim
079.099  000.202  000.202: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/syntax/syncolor.vim
079.445  001.058  000.856: sourcing /apps/nttech/rbhanot/.config/nvim/settings.vim
082.170  000.243  000.243: sourcing /apps/nttech/rbhanot/.config/nvim/mappings.vim
089.026  000.213  000.213: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/syntax/syncolor.vim
089.647  000.194  000.194: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/syntax/syncolor.vim
095.374  000.134  000.134: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/onedark.vim/autoload/onedark.vim
110.779  022.549  022.007: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/onedark.vim/colors/onedark.vim
110.786  026.078  003.529: sourcing /apps/nttech/rbhanot/.config/nvim/colors.vim
110.791  091.349  011.573: sourcing /apps/nttech/rbhanot/.config/nvim/init.vim
110.793  002.795: sourcing vimrc file(s)
118.587  000.094  000.094: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/deoplete.nvim/autoload/deoplete.vim
118.682  002.464  002.370: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/deoplete.nvim/plugin/deoplete.vim
123.330  000.061  000.061: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/filetype.vim
123.554  000.038  000.038: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/ftplugin.vim
123.702  000.657  000.559: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/jedi-vim/plugin/jedi.vim
133.354  003.378  003.378: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/nerdcommenter/plugin/NERD_commenter.vim
141.299  000.244  000.244: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/ctrlp.vim/autoload/ctrlp/mrufiles.vim
141.452  003.535  003.291: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/ctrlp.vim/plugin/ctrlp.vim
146.006  000.065  000.065: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neoformat/plugin/neoformat.vim
150.843  000.251  000.251: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neomake/plugin/neomake.vim
155.332  000.136  000.136: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/vim-highlightedyank/plugin/highlightedyank.vim
159.743  000.105  000.105: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/lightline.vim/plugin/lightline.vim
161.497  000.602  000.602: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/plugin/gzip.vim
161.543  000.018  000.018: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/plugin/health.vim
161.617  000.052  000.052: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/plugin/man.vim
162.059  000.418  000.418: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/plugin/matchit.vim
162.236  000.150  000.150: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/plugin/matchparen.vim
162.666  000.403  000.403: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/plugin/netrwPlugin.vim
166.553  000.604  000.604: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/autoload/remote/host.vim
167.037  000.220  000.220: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/autoload/remote/define.vim
167.125  001.624  000.800: sourcing /apps/nttech/rbhanot/.local/share/nvim/rplugin.vim
167.132  004.425  002.801: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/plugin/rplugin.vim
167.205  000.039  000.039: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/plugin/rrhelper.vim
167.324  000.093  000.093: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/plugin/shada.vim
167.388  000.036  000.036: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/plugin/spellfile.vim
167.548  000.132  000.132: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/plugin/tarPlugin.vim
167.676  000.101  000.101: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/plugin/tohtml.vim
167.736  000.030  000.030: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/plugin/tutor.vim
167.914  000.144  000.144: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/plugin/zipPlugin.vim
167.923  039.895: loading plugins
168.051  000.128: loading packages
168.136  000.085: loading after plugins
168.144  000.008: inits 3
1942.969  1774.825: reading ShaDa
1944.427  001.458: clearing screen
1958.795  000.098  000.098: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/autoload/provider/pythonx.vim
1958.918  000.831  000.733: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/autoload/provider/python3.vim
1959.199  000.027  000.027: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/autoload/provider.vim
2391.237  433.879  433.021: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/jedi-vim/autoload/jedi.vim
2391.475  436.849  002.970: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/jedi-vim/ftplugin/python/jedi.vim
2392.999  000.873  000.873: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/ftplugin/python.vim
2398.721  000.044  000.044: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/jedi-vim/after/ftplugin/python/jedi.vim
2399.764  000.632  000.632: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/indent/python.vim
2401.409  001.087  001.087: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/syntax/python.vim
2403.871  000.167  000.167: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/jedi-vim/after/syntax/python.vim
2409.454  000.228  000.228: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neomake/autoload/neomake/makers/ft/python.vim
2409.636  001.301  001.073: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neomake/autoload/neomake/makers/ft/python.vim
2414.306  001.269  001.269: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neomake/autoload/neomake.vim
2417.206  000.236  000.236: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neomake/autoload/neomake/compat.vim
2432.229  000.397  000.397: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/lightline.vim/autoload/lightline.vim
2435.793  000.090  000.090: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/lightline.vim/autoload/lightline/tab.vim
2443.641  000.198  000.198: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/lightline.vim/autoload/lightline/colorscheme.vim
2444.239  003.260  003.062: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/onedark.vim/autoload/lightline/colorscheme/onedark.vim
2450.882  000.214  000.214: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/ctrlp.vim/autoload/ctrlp/utils.vim
2460.957  070.110: opening buffers
2461.065  000.108: BufEnter autocommands
2461.069  000.004: editing files in windows
2558.750  000.144  000.144: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/deoplete.nvim/autoload/deoplete/mapping.vim
2561.381  000.204  000.204: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/deoplete.nvim/autoload/deoplete/handler.vim
2561.877  100.461: VimEnter autocommands
2562.950  000.749  000.749: sourcing /tmp/.mount_nvimX5THMT/usr/share/nvim/runtime/autoload/provider/clipboard.vim
2562.959  000.333: before starting main loop
2566.608  003.649: first screen update
2566.611  000.003: --- NVIM STARTED ---

So i see VimEnter autocommands to be a bottleneck here but i don't have any autocommands defined in my init.vim. Second i see mappings.vim and plugins.vim being the other culprits. So below are my config files.

init.vim

let vimplug_exists=expand('~/.config/nvim/autoload/plug.vim')
if !filereadable(vimplug_exists)
  if !executable("curl")
    echoerr "You have to install curl or first install vim-plug yourself!"
    execute "q!"
  endif
  echo "Installing Vim-Plug..."
  echo ""
  silent !\curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  let g:not_finish_vimplug = "yes"
  autocmd VimEnter * PlugInstall
endif
source ~/.config/nvim/plugins.vim
source ~/.config/nvim/settings.vim
source ~/.config/nvim/mappings.vim
source ~/.config/nvim/colors.vim

Plugins.vim

call plug#begin('~/.config/nvim/plugged')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins'}
Plug 'zchee/deoplete-jedi', { 'do': ':UpdateRemotePlugins'  }
Plug 'davidhalter/jedi-vim'
Plug 'scrooloose/nerdcommenter'
Plug 'ctrlpvim/ctrlp.vim'"
Plug 'sbdchd/neoformat'
Plug 'neomake/neomake'
Plug 'machakann/vim-highlightedyank'
Plug 'itchyny/lightline.vim'
Plug 'joshdick/onedark.vim'
call plug#end()
inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
inoremap <expr> <CR> pumvisible() ? "\<C-Y>" : "\<CR>"
call deoplete#custom#source('_', 'converters', ['converter_auto_paren'])
let g:deoplete#enable_at_startup = 1
let g:deoplete#enable_ignore_case = 1
let g:deoplete#enable_smart_case = 1
let g:context_filetype#same_filetypes = {}
let g:context_filetype#same_filetypes._ = '_'
let g:python_host_prog  = '/usr/bin/python'
let g:python3_host_prog = '/usr/bin/python3'
let g:jedi#completions_enabled = 0
let g:jedi#goto_command = ",,d"
let g:jedi#usages_command = ",,o"
let g:jedi#goto_assignments_command = ',,a'
let g:jedi#rename_command = ",,r"
let g:jedi#documentation_command = "K"
let g:jedi#use_splits_not_buffers = "right"
call neomake#configure#automake('nrwi', 200)
let g:neomake_python_enabled_makers = ['flake8']
let g:neomake_open_list = 0
nnoremap ,, :Neoformat<CR>
noremap <C-_> :call NERDComment(0,"toggle")<CR>
let g:NERDSpaceDelims = 1
let g:NERDCompactSexyComs = 1
let g:NERDDefaultAlign = 'left'
let g:NERDAltDelims_java = 1
let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } }
let g:NERDCommentEmptyLines = 1
let g:NERDTrimTrailingWhitespace = 1
let g:NERDToggleCheckAllLines = 1
let g:lightline = {'colorscheme':'onedark'}

mappings.vim

let mapleader = "\<Space>"
noremap <leader>r :source $MYVIMRC<cr>
inoremap <expr> <CR> pumvisible() ? "\<C-Y>" : "\<CR>"
noremap <left> <Nop>
noremap <right> <Nop>
noremap <up> <Nop>
noremap <down> <Nop>
inoremap <left> <Nop>
inoremap <right> <Nop>
inoremap <up> <Nop>
inoremap <down> <Nop>
vnoremap <left> <Nop>
vnoremap <right> <Nop>
vnoremap <up> <Nop>
vnoremap <down> <Nop>
cmap W w
cmap Q q
nnoremap ci/ f/cT/
nnoremap di/ f/dT/
nnoremap ci, f,cT,
nnoremap di, f,dT,
noremap <leader>h :nohl<CR>
vnoremap <leader>h :nohl<CR>
nmap <C-N><C-N> :set invnumber<CR>
nnoremap <C-x> :b#<CR>
noremap <leader>, :bd<CR> 
noremap <c-j> <c-w>j
noremap <c-k> <c-w>k
noremap <c-l> <c-w>l
noremap <c-h> <c-w>h
noremap <a-h> :sp<CR>
noremap <a-v> :vsp<CR>
inoremap <a-h> <ESC>:sp<CR>
inoremap <a-v> <ESC>:vsp<CR>
noremap <Leader>t <ESC>:tabnew %:h<CR>
noremap <S-Tab> <ESC>:tabnext<CR>
noremap <leader>o :vertical wincmd f<CR>
vnoremap < <gv " better indentation
vnoremap > >gv " better indentation
set pastetoggle=<F2>
nnoremap j gj
nnoremap k gk
nnoremap Y y$
nnoremap ,o o<ESC>k
nnoremap ,O O<ESC>j
noremap <Leader>c "*y
noremap <Leader>v "*p
nnoremap <leader>- :wincmd _<cr>:wincmd \|<cr>
nnoremap <leader>= :wincmd =<cr>
if has("nvim")
    nnoremap <C-Q> :sp <CR> :term python % <CR>a
  tnoremap <Esc> <C-\><C-n>   "tnoremap stands for terminal mode mappings in neovim"
  tnoremap <c-h> <C-\><C-N><C-w>h
  tnoremap <c-j> <C-\><C-N><C-w>j
  tnoremap <c-k> <C-\><C-N><C-w>k
  tnoremap <c-j> <C-\><C-N><C-w>j

endif

settings.vim

set background=dark
set encoding=utf-8
set t_Co=256
set visualbell    " stop that ANNOYING beeping
set textwidth=100
set wrap
set linebreak
set nolist
set cursorline              " highlight current line
set showmatch               " highlight matching [{()}]
set wildmode=list:longest,full
set lazyredraw              " redraw only when we need to.
set relativenumber number
set ignorecase              " ignore case when searching
set smartcase                               " make search case Sensitive if it contains an Uppercase letter otherwise search is case insensitive
set nofoldenable              " enable folding
set foldmethod=indent
set foldlevel=10
set foldlevelstart=0   " open most folds by default
set nobackup
set nowritebackup
set noswapfile
set clipboard=unnamed " copy to system clipboard
set splitbelow
set splitright
set tabstop=2
set softtabstop=2
set shiftwidth=2
au BufNewFile,BufRead *.py
    \ set tabstop=4         " number of visual spaces per TAB
    \ set softtabstop=4     " number of spaces in tab when editing
    \ set shiftwidth=4      " when using the >> or << commands, shift lines by 4 spaces
    \ set textwidth=100
    \ set expandtab         " expand tabs into spaces
    \ set autoindent
    \ set fileformat=unix
au BufNewFile,BufRead *.js, *.html, *.css
    \ set tabstop=2
    \ set softtabstop=2
    \ set shiftwidth=2
if has("nvim")
    set guicursor=
    let $NVIM_TUI_ENABLE_CURSOR_SHAPE = 0
    set inccommand=nosplit
endif

colors.vim colo onedark


I tried running nvim with a minimal.vim as config file and in that startup is really really fast and below is my minimal.init and then the log for the same

minimal.vim

set background=dark
set encoding=utf-8
set t_Co=256

=============================

 times in msec
  clock   self+sourced   self:  sourced script
  clock   elapsed:              other lines

 000.025  000.025: --- NVIM STARTING ---
 009.055  009.030: locale set
 016.067  007.012: inits 1
 016.079  000.011: window checked
 016.184  000.106: parsing arguments
 016.258  000.074: expanding arguments
 016.304  000.046: inits 2
 016.761  000.457: init highlight
 019.408  000.440  000.440: sourcing minimal.vim
 019.417  002.216: sourcing vimrc file(s)
 025.897  005.561  005.561: sourcing /tmp/.mount_nvimslfgXy/usr/share/nvim/runtime/filetype.vim
 026.752  000.507  000.507: sourcing /tmp/.mount_nvimslfgXy/usr/share/nvim/runtime/ftplugin.vim
 027.320  000.454  000.454: sourcing /tmp/.mount_nvimslfgXy/usr/share/nvim/runtime/indent.vim
 028.282  000.209  000.209: sourcing /tmp/.mount_nvimslfgXy/usr/share/nvim/runtime/syntax/syncolor.vim
 028.390  000.428  000.219: sourcing /tmp/.mount_nvimslfgXy/usr/share/nvim/runtime/syntax/synload.vim
 028.418  000.951  000.523: sourcing /tmp/.mount_nvimslfgXy/usr/share/nvim/runtime/syntax/syntax.vim
 029.743  000.581  000.581: sourcing /tmp/.mount_nvimslfgXy/usr/share/nvim/runtime/plugin/gzip.vim
 029.789  000.019  000.019: sourcing /tmp/.mount_nvimslfgXy/usr/share/nvim/runtime/plugin/health.vim
 029.859  000.048  000.048: sourcing /tmp/.mount_nvimslfgXy/usr/share/nvim/runtime/plugin/man.vim
 030.293  000.409  000.409: sourcing /tmp/.mount_nvimslfgXy/usr/share/nvim/runtime/plugin/matchit.vim
 030.465  000.145  000.145: sourcing /tmp/.mount_nvimslfgXy/usr/share/nvim/runtime/plugin/matchparen.vim
 030.856  000.364  000.364: sourcing /tmp/.mount_nvimslfgXy/usr/share/nvim/runtime/plugin/netrwPlugin.vim
 033.225  000.575  000.575: sourcing /tmp/.mount_nvimslfgXy/usr/share/nvim/runtime/autoload/remote/host.vim
 033.552  000.174  000.174: sourcing /tmp/.mount_nvimslfgXy/usr/share/nvim/runtime/autoload/remote/define.vim
 033.639  001.145  000.397: sourcing /apps/nttech/rbhanot/.local/share/nvim/rplugin.vim
 033.646  002.748  001.603: sourcing /tmp/.mount_nvimslfgXy/usr/share/nvim/runtime/plugin/rplugin.vim
 033.720  000.039  000.039: sourcing /tmp/.mount_nvimslfgXy/usr/share/nvim/runtime/plugin/rrhelper.vim
 033.833  000.087  000.087: sourcing /tmp/.mount_nvimslfgXy/usr/share/nvim/runtime/plugin/shada.vim
 033.896  000.032  000.032: sourcing /tmp/.mount_nvimslfgXy/usr/share/nvim/runtime/plugin/spellfile.vim
 034.051  000.127  000.127: sourcing /tmp/.mount_nvimslfgXy/usr/share/nvim/runtime/plugin/tarPlugin.vim
 034.175  000.094  000.094: sourcing /tmp/.mount_nvimslfgXy/usr/share/nvim/runtime/plugin/tohtml.vim
 034.229  000.026  000.026: sourcing /tmp/.mount_nvimslfgXy/usr/share/nvim/runtime/plugin/tutor.vim
 034.392  000.137  000.137: sourcing /tmp/.mount_nvimslfgXy/usr/share/nvim/runtime/plugin/zipPlugin.vim
 034.400  002.655: loading plugins
 034.518  000.118: loading packages
 034.585  000.068: loading after plugins
 034.592  000.006: inits 3
 652.960  618.369: reading ShaDa
 654.446  001.486: clearing screen
 665.205  000.840  000.840: sourcing /tmp/.mount_nvimslfgXy/usr/share/nvim/runtime/ftplugin/python.vim
 666.358  000.526  000.526: sourcing /tmp/.mount_nvimslfgXy/usr/share/nvim/runtime/indent/python.vim
 667.725  001.050  001.050: sourcing /tmp/.mount_nvimslfgXy/usr/share/nvim/runtime/syntax/python.vim
 668.134  011.271: opening buffers
668.154  000.020: BufEnter autocommands
668.156  000.002: editing files in windows
668.236  000.080: VimEnter autocommands
668.238  000.002: before starting main loop
671.087  002.849: first screen update
671.091  000.004: --- NVIM STARTED --

Even i tried running nvim with noplugins option as well but even that also does not do much improvement which makes me think there is some setting that is causing the issue but i am not able to figure it out.

Any help would be much appreciated.

PS: I am new to vim/neovim and i really want to learn and work on it but this is somehow being a roadblock for me to use neovim. And i really want to use neovim because the advantage of having a built in terminal helps to get away from tmux+vim combo..

3
  • You might try without any plugins to see if plugins cause this. Also from your logfile it looks like the provider.vim causes some delay. Commented Aug 1, 2018 at 14:24
  • It only happens for the first time only when and then subsequent launches are relatively faster. Commented Aug 1, 2018 at 14:44
  • that looks specifically only like a neovim only problem. So you might want to ask at their issue tracker Commented Aug 2, 2018 at 6:30

2 Answers 2

2

Okay it looks like those logfiles have been changed since the last time I looked at them (I remember some provider plugin to be particularly bad, but I do not see it here now, which was the reason I suggested moving this to the neovim bugtracker).

Okay, you need to figure out what makes start up so small. Here is an example how I would proceed, note, you'll have to do the final work and analysis I am not going to do that for your ;)

Trying with the first startuptime logfile for the first session:

        clock   self+sourced   self:  sourced script
        clock   elapsed:              other lines

    000.009  000.009: --- NVIM STARTING ---
    009.986  009.977: locale set
    018.750  008.764: inits 1
    018.764  000.014: window checked
    018.842  000.078: parsing arguments
    020.031  001.189: expanding arguments
    020.081  000.051: inits 2
    020.591  000.510: init highlight
    2162.962  446.040  446.040: sourcing /apps/nttech/rbhanot/.config/nvim/autoload/plug.vim
    4363.032  265.956  265.956: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/filetype.vim
    4374.207  000.761  000.761: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/ftplugin.vim
    4384.176  000.624  000.624: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/indent.vim
    4511.851  000.251  000.251: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/syntax/syncolor.vim
    4559.538  048.912  048.661: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/syntax/synload.vim
    4559.623  174.580  125.668: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/syntax/syntax.vim
    4719.856  019.373  019.373: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/deoplete.nvim/autoload/deoplete/custom.vim
    4818.131  095.671  095.671: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/deoplete.nvim/autoload/deoplete/util.vim
    4865.563  044.503  044.503: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/deoplete.nvim/autoload/deoplete/init.vim
    5553.428  086.264  086.264: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neomake/autoload/neomake/configure.vim
    5625.453  068.322  068.322: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neomake/autoload/neomake/config.vim
    5766.744  138.128  138.128: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neomake/autoload/neomake/log.vim
    5880.082  023.316  023.316: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neomake/autoload/neomake/core.vim
    5880.362  110.428  087.112: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neomake/autoload/neomake/utils.vim
    5881.801  4591.203  3140.554: sourcing /apps/nttech/rbhanot/.config/nvim/plugins.vim
    6131.604  000.196  000.196: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/syntax/syncolor.vim
    6131.941  246.633  246.437: sourcing /apps/nttech/rbhanot/.config/nvim/settings.vim
    8233.645  2099.276  2099.276: sourcing /apps/nttech/rbhanot/.config/nvim/mappings.vim
    8667.321  000.210  000.210: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/syntax/syncolor.vim
    8667.962  000.184  000.184: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/syntax/syncolor.vim
    9128.201  057.730  057.730: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/onedark.vim/autoload/onedark.vim
    9143.354  893.845  835.721: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/onedark.vim/colors/onedark.vim
    9143.363  906.383  012.538: sourcing /apps/nttech/rbhanot/.config/nvim/colors.vim
    9143.367  9112.849  1269.354: sourcing /apps/nttech/rbhanot/.config/nvim/init.vim
    9143.370  009.931: sourcing vimrc file(s)
    9500.542  168.125  168.125: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/deoplete.nvim/autoload/deoplete.vim
    9500.640  248.886  080.761: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/deoplete.nvim/plugin/deoplete.vim
    9837.148  000.064  000.064: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/filetype.vim
    9837.393  000.032  000.032: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/ftplugin.vim
    9837.551  314.860  314.764: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/jedi-vim/plugin/jedi.vim
    10110.528  254.186  254.186: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/nerdcommenter/plugin/NERD_commenter.vim
    10327.254  138.892  138.892: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/ctrlp.vim/autoload/ctrlp/mrufiles.vim
    10327.400  178.883  039.991: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/ctrlp.vim/plugin/ctrlp.vim
    10448.190  101.616  101.616: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neoformat/plugin/neoformat.vim
    10758.798  197.868  197.868: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neomake/plugin/neomake.vim
    10846.685  065.937  065.937: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/vim-highlightedyank/plugin/highlightedyank.vim
    12296.180  830.588  830.588: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/lightline.vim/plugin/lightline.vim
    12300.560  002.324  002.324: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/gzip.vim
    12300.621  000.021  000.021: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/health.vim
    12300.702  000.055  000.055: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/man.vim
    12301.157  000.429  000.429: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/matchit.vim
    12301.336  000.151  000.151: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/matchparen.vim
    12301.754  000.390  000.390: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/netrwPlugin.vim
    12710.640  002.290  002.290: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/autoload/remote/host.vim
    12711.174  000.242  000.242: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/autoload/remote/define.vim
    12711.269  407.030  404.497: sourcing /apps/nttech/rbhanot/.local/share/nvim/rplugin.vim
    12711.279  409.492  002.462: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/rplugin.vim
    12711.429  000.110  000.110: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/rrhelper.vim
    12711.642  000.151  000.151: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/shada.vim
    12711.741  000.065  000.065: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/spellfile.vim
    12711.919  000.144  000.144: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/tarPlugin.vim
    12712.068  000.100  000.100: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/tohtml.vim
    12712.151  000.033  000.033: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/tutor.vim
    12712.329  000.149  000.149: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/plugin/zipPlugin.vim
    12712.341  962.533: loading plugins
    12712.501  000.161: loading packages
    12713.280  000.779: loading after plugins
    12713.289  000.008: inits 3
    13329.357  616.069: reading ShaDa
    13330.852  001.494: clearing screen
    13471.229  132.012  132.012: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neomake/autoload/neomake.vim
    13522.013  048.045  048.045: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/neomake/autoload/neomake/compat.vim
    13614.739  083.898  083.898: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/lightline.vim/autoload/lightline.vim
    13726.571  100.799  100.799: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/lightline.vim/autoload/lightline/tab.vim
    14180.150  201.807  201.807: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/lightline.vim/autoload/lightline/colorscheme.vim
    14180.879  324.479  122.672: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/onedark.vim/autoload/lightline/colorscheme/onedark.vim
    14183.512  163.427: opening buffers
    14183.638  000.127: BufEnter autocommands
    14183.641  000.003: editing files in windows
    14194.265  002.221  002.221: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/autoload/provider/pythonx.vim
    14194.736  000.253  000.253: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/autoload/provider/python3.vim
    14201.950  000.095  000.095: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/autoload/provider.vim
    24842.491  422.066  422.066: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/deoplete.nvim/autoload/deoplete/mapping.vim
    25118.676  265.119  265.119: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/deoplete.nvim/autoload/deoplete/handler.vim
    25119.092  10245.697: VimEnter autocommands
    25122.433  003.006  003.006: sourcing /tmp/.mount_nvimPMuxUu/usr/share/nvim/runtime/autoload/provider/clipboard.vim
    25122.454  000.356: before starting main loop
    25123.773  001.319: first screen update
    25123.776  000.003: --- NVIM STARTED ---

There are a couple of things to notice here. First, looking at the path, it looks like some of your runtime files are mounted. I hope not you are using a remote filesystem, because just scanning those files may take longer than expected. I used to have my $VIMRUNTIME environment on a samba share and that made loading all those files really slow. So you might want to reconsider this option.

Also I see that syncolor.vim and filetype.vim is loaded several times. This shouldn't be too bad, since there is a guard at that file, that should preventing it from being loaded several times. But nevertheless this looks suspicious.

Third, let's sort the startupfile logfile by the self time. Use visual mode and select those lines with a leading number and use the following vim command:

'<,'>sort! fr /^\s*[0-9.]\+\s\+[0-9.]\+\s\+\zs[0-9.]\+/

This means, reverse sort by float numbers in the third column when there are some. Check the help for the various flags and options of the :sort command.

This will likely come up with a list like this:

    5881.801  4591.203  3140.554: sourcing /apps/nttech/rbhanot/.config/nvim/plugins.vim
    8233.645  2099.276  2099.276: sourcing /apps/nttech/rbhanot/.config/nvim/mappings.vim
    9143.367  9112.849 1269.354: sourcing /apps/nttech/rbhanot/.config/nvim/init.vim
    9143.354 893.845 835.721: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/onedark.vim/colors/onedark.vim
    12296.180  830.588  830.588: sourcing /apps/nttech/rbhanot/.config/nvim/plugged/lightline.vim/plugin/lightline.vim

This means that your plugins.vim file took 3 seconds to load, your mappings.vim file 2 seconds, your init.vim file 1.2 seconds and the onedark colorscheme almost a second and the lightline plugin also almost a second.

Now inspect your files:

plugins.vim

    call plug#begin('~/.config/nvim/plugged')
    Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins'}
    Plug 'zchee/deoplete-jedi', { 'do': ':UpdateRemotePlugins'  }
[...]

I don't know Plug.vim very well, but it looks like it calls :UpdateRemotePlugins everytime and that twice. Do you really need to do this every time?

[...]
    let g:deoplete#enable_at_startup = 1
    let g:deoplete#enable_ignore_case = 1
    let g:deoplete#enable_smart_case = 1
    let g:context_filetype#same_filetypes = {}
    let g:context_filetype#same_filetypes._ = '_'
    call neomake#configure#automake('nrwi', 200)
    [...]

Using :help autoload syntax (foobar#variable) means, those plugins will be loaded. Is this really needed?

For mappings.vim I see nothing obvious which makes it so slow. You need to find out by commenting one half out and check if this makes a difference. Do this some kind of bisecting until you find the offending problematic part.

Finally, have a look at your lightline and onedark.vim plugin. Read the documentation or try to find out (check the issue tracker) why those plugins are slow and if it can be made faster. Most likely this will also mean, bisecting different plugin settings and check if that makes a noticable difference.

You need to do this also with the startup logfile for the 3rd time, which looks totally different. Not sure what could cause the difference here. So you need to do the work your self.

And at last, let me give you a recommendation to always think whether you really need all those plugins. As you have noticed they may slow down your startup time down considerably. Perhaps you don't need to have them loaded each and every time you start vim? Perhaps they can be loaded on demand using e.g. the :packadd command? This is not an easy decision, but may well be worth it.

Slow startuptime is usually a tricky problem, but no one except you can go through your own configuration files and check them.

6
  • Really thorough and great answer, i will surely go through all of the steps and see how it goes. Commented Aug 9, 2018 at 13:52
  • hey, one noob question, i am trying to setup my neovim into ssd drive. Though i have symlinked my ~/.config/nvim -> /ssd/noevim-config still nvim is trying to write local data into ~/.local/share/nvim and also $VIMRUNTIME and $VIM is being set to weird /tmp.mountXXXX directory which actually doesn't even exist on system and you also mentioned the same in your answer. So is there a way i can change all this and configure it compeltly in my ssd drive Commented Aug 9, 2018 at 15:00
  • infact when i launch nvim now, it is not able to locate its init.vim as well which i suppose is because it is unable find the runtimepath. Commented Aug 9, 2018 at 15:13
  • Anyways i fixed it by creating fresh symlinks... Commented Aug 9, 2018 at 15:27
  • hey do you know why my $VIMRUNTIME and $VIM is being set to weird /tmp.mountXXXX directory which actually doesn't even exist on system Commented Aug 10, 2018 at 8:59
0

in the past, I have vim to sleep, then: I use a multi Chrono in vimrc to check the line that caused to sleep my vim by adding :echo '$msg' in multi-line in my config, like that:

" starting chrono:
let startvim = reltime()

let vimplug_exists=expand('~/.config/nvim/autoload/plug.vim')
if !filereadable(vimplug_exists)
  if !executable("curl")
    echoerr "You have to install curl or first install vim-plug yourself!"
    execute "q!"
  endif
  echo "Installing Vim-Plug..."
  echo ""
  silent !\curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  let g:not_finish_vimplug = "yes"
  autocmd VimEnter * PlugInstall
endif
echo "1" | echo reltimestr(reltime(startvim))
source ~/.config/nvim/plugins.vim
echo "2" | echo reltimestr(reltime(startvim))
source ~/.config/nvim/settings.vim
echo "3" | echo reltimestr(reltime(startvim))
source ~/.config/nvim/mappings.vim
echo "4" | echo reltimestr(reltime(startvim))
source ~/.config/nvim/colors.vim
echo "end" | echo reltimestr(reltime(startvim))
1
  • If you’re just collecting timings, the --startuptime mentioned in the OP is going to be more detailed and accurate …
    – D. Ben Knoble
    Commented Aug 28, 2021 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.