Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow startuptime #702

Closed
vzytoi opened this issue Nov 18, 2021 · 5 comments
Closed

Slow startuptime #702

vzytoi opened this issue Nov 18, 2021 · 5 comments
Labels

Comments

@vzytoi
Copy link

vzytoi commented Nov 18, 2021

Hey! I'm having issue concerning my vim startuptime, this issue had already been asked here : #191 but it didn't helped my case.
I'm just wandering if this startuptime is slow or if it is in fact normal and if it's not, how can I make it faster?
Here is my startuptime : :StartupTime --tries 20 :

       startup: 511.1
event                  time percent plot
packer_compiled.lua  173.60   33.97 ██████████████████████████
cmp-tabnine.lua      160.18   31.34 ████████████████████████
coc.vim               34.86    6.82 █████
init.lua              28.90    5.66 ████▌
loading plugins       19.79    3.87 ███
locale set            17.27    3.38 ██▌
loading packages      15.11    2.96 ██
filetype.vim          13.51    2.64 ██
first screen update   13.21    2.58 ██
spacecamp.vim         12.62    2.47 ██
reading ShaDa          7.95    1.56 █
VimEnter autocommand   3.91    0.76 ▌
loading after plugin   3.55    0.69 ▌
parsing arguments      3.42    0.67 ▌
init highlight         2.48    0.49 ▌
done waiting for UI    1.69    0.33
(... I cut the rest)

  • nvim --version:
NVIM v0.6.0-dev+205-g9695691ee
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilé par runneradmin@fv-az152-120

Features: -acl +iconv +tui
See ":help feature-compile"

         fichier vimrc système : "$VIM\sysinit.vim"
               $VIM par défaut : "C:/Program Files/nvim/share/nvim"

Run :checkhealth for more info
  • git --version:
git version 2.33.1.windows.1
  • Operating system/version: Windows 10
  • Terminal name/version: Powershell

packer files

packer compiled file
-- Automatically generated packer.nvim plugin loader code

if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
  vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
  return
end

vim.api.nvim_command('packadd packer.nvim')

local no_errors, error_msg = pcall(function()

  local time
  local profile_info
  local should_profile = false
  if should_profile then
    local hrtime = vim.loop.hrtime
    profile_info = {}
    time = function(chunk, start)
      if start then
        profile_info[chunk] = hrtime()
      else
        profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
      end
    end
  else
    time = function(chunk, start) end
  end
  
local function save_profiles(threshold)
  local sorted_times = {}
  for chunk_name, time_taken in pairs(profile_info) do
    sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
  end
  table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
  local results = {}
  for i, elem in ipairs(sorted_times) do
    if not threshold or threshold and elem[2] > threshold then
      results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
    end
  end

  _G._packer = _G._packer or {}
  _G._packer.profile_output = results
end

time([[Luarocks path setup]], true)
local package_path_str = "C:\\Users\\Cyprien\\AppData\\Local\\Temp\\nvim\\packer_hererocks\\2.1.0-beta3\\share\\lua\\5.1\\?.lua;C:\\Users\\Cyprien\\AppData\\Local\\Temp\\nvim\\packer_hererocks\\2.1.0-beta3\\share\\lua\\5.1\\?\\init.lua;C:\\Users\\Cyprien\\AppData\\Local\\Temp\\nvim\\packer_hererocks\\2.1.0-beta3\\lib\\luarocks\\rocks-5.1\\?.lua;C:\\Users\\Cyprien\\AppData\\Local\\Temp\\nvim\\packer_hererocks\\2.1.0-beta3\\lib\\luarocks\\rocks-5.1\\?\\init.lua"
local install_cpath_pattern = "C:\\Users\\Cyprien\\AppData\\Local\\Temp\\nvim\\packer_hererocks\\2.1.0-beta3\\lib\\lua\\5.1\\?.so"
if not string.find(package.path, package_path_str, 1, true) then
  package.path = package.path .. ';' .. package_path_str
end

if not string.find(package.cpath, install_cpath_pattern, 1, true) then
  package.cpath = package.cpath .. ';' .. install_cpath_pattern
end

time([[Luarocks path setup]], false)
time([[try_loadstring definition]], true)
local function try_loadstring(s, component, name)
  local success, result = pcall(loadstring(s))
  if not success then
    vim.schedule(function()
      vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
    end)
  end
  return result
end

time([[try_loadstring definition]], false)
time([[Defining packer_plugins]], true)
_G.packer_plugins = {
  ["cmp-calc"] = {
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\cmp-calc",
    url = "https://github.com/hrsh7th/cmp-calc"
  },
  ["cmp-nvim-ultisnips"] = {
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\cmp-nvim-ultisnips",
    url = "https://github.com/quangnguyen30192/cmp-nvim-ultisnips"
  },
  ["cmp-path"] = {
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\cmp-path",
    url = "https://github.com/hrsh7th/cmp-path"
  },
  ["cmp-tabnine"] = {
    config = { "require('plugins.cmp').tabnine_config()" },
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\cmp-tabnine",
    url = "https://github.com/adrianiy/cmp-tabnine"
  },
  ["coc.nvim"] = {
    config = { "require('plugins.coc')" },
    loaded = false,
    needs_bufread = false,
    only_cond = false,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\opt\\coc.nvim",
    url = "https://github.com/neoclide/coc.nvim"
  },
  ["diffview.nvim"] = {
    config = { "require('diffview').setup{}" },
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\diffview.nvim",
    url = "https://github.com/sindrets/diffview.nvim"
  },
  ["gitsigns.nvim"] = {
    config = { "require('gitsigns').setup()" },
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\gitsigns.nvim",
    url = "https://github.com/lewis6991/gitsigns.nvim"
  },
  harpoon = {
    config = { "\27LJ\2\nä\1\0\0\a\0\14\0\0176\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\4\0005\3\3\0=\3\5\0025\3\v\0005\4\t\0005\5\a\0005\6\6\0=\6\b\5=\5\n\4=\4\f\3=\3\r\2B\0\2\1K\0\1\0\rprojects\25~\\Appdata\\Local\\nvim\1\0\0\tterm\1\0\0\tcmds\1\0\0\1\2\0\0\nungit\20global_settings\1\0\0\1\0\3\21enter_on_sendcmd\1\19save_on_change\2\19save_on_toggle\1\nsetup\fharpoon\frequire\0" },
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\harpoon",
    url = "https://github.com/ThePrimeagen/harpoon"
  },
  ["impatient.nvim"] = {
    config = { "require('impatient')" },
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\impatient.nvim",
    url = "https://github.com/lewis6991/impatient.nvim"
  },
  ["lspkind-nvim"] = {
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\lspkind-nvim",
    url = "https://github.com/onsails/lspkind-nvim"
  },
  ["lualine.nvim"] = {
    config = { "require 'plugins.lualine'.config()" },
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\lualine.nvim",
    url = "https://github.com/hoob3rt/lualine.nvim"
  },
  ["neoscroll.nvim"] = {
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\neoscroll.nvim",
    url = "https://github.com/karb94/neoscroll.nvim"
  },
  ["nest.nvim"] = {
    config = { "require('mappings')" },
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\nest.nvim",
    url = "https://github.com/LionC/nest.nvim"
  },
  ["nvim-autopairs"] = {
    config = { "\27LJ\2\n \1\0\0\5\0\n\0\r6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0005\3\5\0005\4\4\0=\4\6\0035\4\a\0=\4\b\3=\3\t\2B\0\2\1K\0\1\0\14ts_config\15javascript\1\2\0\0\20template_string\blua\1\0\0\1\2\0\0\vstring\1\0\1\rcheck_ts\2\nsetup\19nvim-autopairs\frequire\0" },
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\nvim-autopairs",
    url = "https://github.com/windwp/nvim-autopairs"
  },
  ["nvim-biscuits"] = {
    config = { "\27LJ\2\n}\0\0\4\0\6\0\t6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0005\3\4\0=\3\5\2B\0\2\1K\0\1\0\19default_config\1\0\1\18prefix_string\5\1\0\1\21cursor_line_only\2\nsetup\18nvim-biscuits\frequire\0" },
    load_after = {
      ["nvim-treesitter"] = true
    },
    loaded = false,
    needs_bufread = false,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\opt\\nvim-biscuits",
    url = "https://github.com/code-biscuits/nvim-biscuits"
  },
  ["nvim-cheat.sh"] = {
    commands = { "Cheat" },
    loaded = false,
    needs_bufread = false,
    only_cond = false,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\opt\\nvim-cheat.sh",
    url = "https://github.com/RishabhRD/nvim-cheat.sh"
  },
  ["nvim-cmp"] = {
    config = { "require('plugins.cmp').config()" },
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\nvim-cmp",
    url = "https://github.com/hrsh7th/nvim-cmp"
  },
  ["nvim-comment"] = {
    config = { "\27LJ\2\n^\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\25update_commentstring&ts_context_commentstring.internal\frequire^\1\0\4\0\6\0\t6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0003\3\4\0=\3\5\2B\0\2\1K\0\1\0\thook\0\1\0\1\18comment_empty\1\nsetup\17nvim_comment\frequire\0" },
    load_after = {
      ["nvim-ts-context-commentstring"] = true
    },
    loaded = false,
    needs_bufread = false,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\opt\\nvim-comment",
    url = "https://github.com/terrortylor/nvim-comment"
  },
  ["nvim-treesitter"] = {
    after = { "nvim-biscuits", "nvim-treesitter-textobjects", "nvim-ts-context-commentstring", "nvim-treesitter-textsubjects", "nvim-ts-autotag" },
    config = { "require 'plugins.treesitter'" },
    loaded = false,
    needs_bufread = true,
    only_cond = false,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\opt\\nvim-treesitter",
    url = "https://github.com/nvim-treesitter/nvim-treesitter"
  },
  ["nvim-treesitter-textobjects"] = {
    load_after = {
      ["nvim-treesitter"] = true
    },
    loaded = false,
    needs_bufread = false,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\opt\\nvim-treesitter-textobjects",
    url = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects"
  },
  ["nvim-treesitter-textsubjects"] = {
    load_after = {
      ["nvim-treesitter"] = true
    },
    loaded = false,
    needs_bufread = false,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\opt\\nvim-treesitter-textsubjects",
    url = "https://github.com/RRethy/nvim-treesitter-textsubjects"
  },
  ["nvim-ts-autotag"] = {
    config = { "require('nvim-ts-autotag').setup()" },
    load_after = {
      ["nvim-treesitter"] = true
    },
    loaded = false,
    needs_bufread = false,
    only_cond = false,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\opt\\nvim-ts-autotag",
    url = "https://github.com/windwp/nvim-ts-autotag"
  },
  ["nvim-ts-context-commentstring"] = {
    after = { "nvim-comment" },
    load_after = {
      ["nvim-treesitter"] = true
    },
    loaded = false,
    needs_bufread = false,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\opt\\nvim-ts-context-commentstring",
    url = "https://github.com/JoosepAlviste/nvim-ts-context-commentstring"
  },
  ["nvim-web-devicons"] = {
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\nvim-web-devicons",
    url = "https://github.com/kyazdani42/nvim-web-devicons"
  },
  ["packer.nvim"] = {
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\packer.nvim",
    url = "https://github.com/wbthomason/packer.nvim"
  },
  ["plenary.nvim"] = {
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\plenary.nvim",
    url = "https://github.com/nvim-lua/plenary.nvim"
  },
  popfix = {
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\popfix",
    url = "https://github.com/RishabhRD/popfix"
  },
  spacecamp = {
    loaded = false,
    needs_bufread = false,
    only_cond = false,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\opt\\spacecamp",
    url = "https://github.com/jaredgorski/spacecamp"
  },
  ["splitjoin.vim"] = {
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\splitjoin.vim",
    url = "https://github.com/AndrewRadev/splitjoin.vim"
  },
  ["stylua-nvim"] = {
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\stylua-nvim",
    url = "https://github.com/ckipp01/stylua-nvim"
  },
  ["targets.vim"] = {
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\targets.vim",
    url = "https://github.com/wellle/targets.vim"
  },
  ["telescope-fzf-native.nvim"] = {
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\telescope-fzf-native.nvim",
    url = "https://github.com/nvim-telescope/telescope-fzf-native.nvim"
  },
  ["telescope.nvim"] = {
    config = { "require('plugins.telescope').config()" },
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\telescope.nvim",
    url = "https://github.com/nvim-telescope/telescope.nvim"
  },
  ["toggleterm.nvim"] = {
    commands = { "ToggleTerm", "TermExec" },
    config = { "require 'plugins.term'.config()" },
    loaded = false,
    needs_bufread = false,
    only_cond = false,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\opt\\toggleterm.nvim",
    url = "https://github.com/akinsho/toggleterm.nvim"
  },
  ["trim.nvim"] = {
    config = { "\27LJ\2\na\0\0\4\0\6\0\t6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\4\0005\3\3\0=\3\5\2B\0\2\1K\0\1\0\fdisable\1\0\0\1\4\0\0\tjson\15javascript\bcss\nsetup\ttrim\frequire\0" },
    loaded = false,
    needs_bufread = false,
    only_cond = false,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\opt\\trim.nvim",
    url = "https://github.com/cappyzawa/trim.nvim"
  },
  ultisnips = {
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\ultisnips",
    url = "https://github.com/SirVer/ultisnips"
  },
  ["vim-MvVis"] = {
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\vim-MvVis",
    url = "https://github.com/Jorengarenar/vim-MvVis"
  },
  ["vim-cool"] = {
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\vim-cool",
    url = "https://github.com/romainl/vim-cool"
  },
  ["vim-fugitive"] = {
    commands = { "G", "Gdiff" },
    loaded = false,
    needs_bufread = true,
    only_cond = false,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\opt\\vim-fugitive",
    url = "https://github.com/tpope/vim-fugitive"
  },
  ["vim-sneak"] = {
    keys = { { "n", "S" }, { "n", "s" } },
    loaded = false,
    needs_bufread = false,
    only_cond = false,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\opt\\vim-sneak",
    url = "https://github.com/justinmk/vim-sneak"
  },
  ["vim-startuptime"] = {
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\vim-startuptime",
    url = "https://github.com/dstein64/vim-startuptime"
  },
  ["vim-surround"] = {
    loaded = true,
    path = "C:\\Users\\Cyprien\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\vim-surround",
    url = "https://github.com/tpope/vim-surround"
  }
}

time([[Defining packer_plugins]], false)
-- Config for: nvim-autopairs
time([[Config for nvim-autopairs]], true)
try_loadstring("\27LJ\2\n \1\0\0\5\0\n\0\r6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0005\3\5\0005\4\4\0=\4\6\0035\4\a\0=\4\b\3=\3\t\2B\0\2\1K\0\1\0\14ts_config\15javascript\1\2\0\0\20template_string\blua\1\0\0\1\2\0\0\vstring\1\0\1\rcheck_ts\2\nsetup\19nvim-autopairs\frequire\0", "config", "nvim-autopairs")
time([[Config for nvim-autopairs]], false)
-- Config for: impatient.nvim
time([[Config for impatient.nvim]], true)
require('impatient')
time([[Config for impatient.nvim]], false)
-- Config for: nest.nvim
time([[Config for nest.nvim]], true)
require('mappings')
time([[Config for nest.nvim]], false)
-- Config for: harpoon
time([[Config for harpoon]], true)
try_loadstring("\27LJ\2\nä\1\0\0\a\0\14\0\0176\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\4\0005\3\3\0=\3\5\0025\3\v\0005\4\t\0005\5\a\0005\6\6\0=\6\b\5=\5\n\4=\4\f\3=\3\r\2B\0\2\1K\0\1\0\rprojects\25~\\Appdata\\Local\\nvim\1\0\0\tterm\1\0\0\tcmds\1\0\0\1\2\0\0\nungit\20global_settings\1\0\0\1\0\3\21enter_on_sendcmd\1\19save_on_change\2\19save_on_toggle\1\nsetup\fharpoon\frequire\0", "config", "harpoon")
time([[Config for harpoon]], false)
-- Config for: nvim-cmp
time([[Config for nvim-cmp]], true)
require('plugins.cmp').config()
time([[Config for nvim-cmp]], false)
-- Config for: cmp-tabnine
time([[Config for cmp-tabnine]], true)
require('plugins.cmp').tabnine_config()
time([[Config for cmp-tabnine]], false)
-- Config for: lualine.nvim
time([[Config for lualine.nvim]], true)
require 'plugins.lualine'.config()
time([[Config for lualine.nvim]], false)
-- Config for: telescope.nvim
time([[Config for telescope.nvim]], true)
require('plugins.telescope').config()
time([[Config for telescope.nvim]], false)
-- Config for: gitsigns.nvim
time([[Config for gitsigns.nvim]], true)
require('gitsigns').setup()
time([[Config for gitsigns.nvim]], false)
-- Config for: diffview.nvim
time([[Config for diffview.nvim]], true)
require('diffview').setup{}
time([[Config for diffview.nvim]], false)

-- Command lazy-loads
time([[Defining lazy-load commands]], true)
pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Gdiff lua require("packer.load")({'vim-fugitive'}, { cmd = "Gdiff", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args>, mods = "<mods>" }, _G.packer_plugins)]])
pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file TermExec lua require("packer.load")({'toggleterm.nvim'}, { cmd = "TermExec", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args>, mods = "<mods>" }, _G.packer_plugins)]])
pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Cheat lua require("packer.load")({'nvim-cheat.sh'}, { cmd = "Cheat", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args>, mods = "<mods>" }, _G.packer_plugins)]])
pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file ToggleTerm lua require("packer.load")({'toggleterm.nvim'}, { cmd = "ToggleTerm", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args>, mods = "<mods>" }, _G.packer_plugins)]])
pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file G lua require("packer.load")({'vim-fugitive'}, { cmd = "G", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args>, mods = "<mods>" }, _G.packer_plugins)]])
time([[Defining lazy-load commands]], false)

-- Keymap lazy-loads
time([[Defining lazy-load keymaps]], true)
vim.cmd [[nnoremap <silent> S <cmd>lua require("packer.load")({'vim-sneak'}, { keys = "S", prefix = "" }, _G.packer_plugins)<cr>]]
vim.cmd [[nnoremap <silent> s <cmd>lua require("packer.load")({'vim-sneak'}, { keys = "s", prefix = "" }, _G.packer_plugins)<cr>]]
time([[Defining lazy-load keymaps]], false)

vim.cmd [[augroup packer_load_aucmds]]
vim.cmd [[au!]]
  -- Filetype lazy-loads
time([[Defining lazy-load filetype autocommands]], true)
vim.cmd [[au FileType html ++once lua require("packer.load")({'nvim-ts-autotag'}, { ft = "html" }, _G.packer_plugins)]]
vim.cmd [[au FileType php ++once lua require("packer.load")({'nvim-ts-autotag'}, { ft = "php" }, _G.packer_plugins)]]
time([[Defining lazy-load filetype autocommands]], false)
  -- Event lazy-loads
time([[Defining lazy-load event autocommands]], true)
vim.cmd [[au BufWritePre * ++once lua require("packer.load")({'trim.nvim'}, { event = "BufWritePre *" }, _G.packer_plugins)]]
vim.cmd [[au BufRead * ++once lua require("packer.load")({'nvim-treesitter'}, { event = "BufRead *" }, _G.packer_plugins)]]
vim.cmd [[au VimEnter * ++once lua require("packer.load")({'coc.nvim'}, { event = "VimEnter *" }, _G.packer_plugins)]]
vim.cmd [[au GUIEnter * ++once lua require("packer.load")({'spacecamp'}, { event = "GUIEnter *" }, _G.packer_plugins)]]
time([[Defining lazy-load event autocommands]], false)
vim.cmd("augroup END")

if should_profile then save_profiles() end

end)

if not no_errors then
  vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
end
my configuration
M = {}

function M.config()

    local execute = vim.api.nvim_command
    local fn = vim.fn

    local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'

    if fn.empty(fn.glob(install_path)) > 0 then
        fn.system({'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path})
        execute 'packadd packer.nvim'
    end

    return require('packer').startup(function(use)

        use 'wbthomason/packer.nvim'
        use 'Jorengarenar/vim-MvVis'
        use 'tpope/vim-surround'
        use 'romainl/vim-cool'
        use 'kyazdani42/nvim-web-devicons'
        use 'wellle/targets.vim'
        use 'SirVer/ultisnips'
        use 'nvim-lua/plenary.nvim'
        use 'onsails/lspkind-nvim'
        use 'ckipp01/stylua-nvim'
        use 'AndrewRadev/splitjoin.vim'
        use 'karb94/neoscroll.nvim'
        use 'dstein64/vim-startuptime'

        use {
            'lewis6991/impatient.nvim',
            config = [[require('impatient')]]
        }

        use {
            'hrsh7th/nvim-cmp',
            config = [[require('plugins.cmp').config()]],
            requires = {
                'quangnguyen30192/cmp-nvim-ultisnips',
                'hrsh7th/cmp-path',
                'hrsh7th/cmp-calc'
            }
        }

        use {
            'adrianiy/cmp-tabnine',
            run = './install.sh',
            config = [[require('plugins.cmp').tabnine_config()]],
            requires = 'hrsh7th/nvim-cmp'
        }

        use {
            'windwp/nvim-autopairs',
            config = function()
                require('nvim-autopairs').setup{
                    check_ts = true,
                    ts_config = {
                        lua = {'string'},
                        javascript = {'template_string'}
                    }
                }
            end
        }

        use {
            'jaredgorski/spacecamp',
            event =  'GUIEnter'
        }

        use {
            'justinmk/vim-sneak',
            keys = {
                {'n', 'S' }, {'n', 's'}
            }
        }

        use {
            'LionC/nest.nvim',
            config = [[require('mappings')]],
        }

        use {
            'cappyzawa/trim.nvim',
            event = 'BufWritePre',
            config = function()
                require('trim').setup({
                    disable = {"json", "javascript", "css"},
                })
            end
        }

        use {
            'sindrets/diffview.nvim',
            requires = 'nvim-lua/plenary.nvim',
            config = [[require('diffview').setup{}]],
        }

        use {
            'akinsho/toggleterm.nvim',
            cmd = { "ToggleTerm", "TermExec" },
            config = [[require 'plugins.term'.config()]],
        }

        use {
            'hoob3rt/lualine.nvim',
            config = [[require 'plugins.lualine'.config()]],
        }

        use {
            'RishabhRD/nvim-cheat.sh',
            requires = { 'RishabhRD/popfix' },
            cmd = { 'Cheat' }
        }

        use {
            'tpope/vim-fugitive',
            cmd = { 'G', 'Gdiff' }
        }

        use {
            'nvim-telescope/telescope.nvim',
            config = [[require('plugins.telescope').config()]],
        }

        use {
            'nvim-telescope/telescope-fzf-native.nvim',
            run = 'make'
        }

        use {
            'nvim-treesitter/nvim-treesitter',
            event = 'BufRead',
            run = ':TSUpdate',
            config = [[require 'plugins.treesitter']],
        }

        use {
            'nvim-treesitter/nvim-treesitter-textobjects',
            after = 'nvim-treesitter'
        }

        use {
            'RRethy/nvim-treesitter-textsubjects',
            after = 'nvim-treesitter'
        }

        use {
            'JoosepAlviste/nvim-ts-context-commentstring',
            after = 'nvim-treesitter'
        }

        use {
            'windwp/nvim-ts-autotag',
            after = 'nvim-treesitter',
            config = [[require('nvim-ts-autotag').setup()]],
            ft = {'html', 'php'}
        }

        use {
            'code-biscuits/nvim-biscuits',
            after = 'nvim-treesitter',
            config = function()
                require('nvim-biscuits').setup({
                    cursor_line_only = true,
                    default_config = {
                        prefix_string = ""
                    }
                })
            end
        }

        use {
            'terrortylor/nvim-comment',
            config = function()
                require('nvim_comment').setup({
                    comment_empty = false,
                    hook = function()
                        require('ts_context_commentstring.internal').update_commentstring()
                    end
                })
            end,
            after = 'nvim-ts-context-commentstring'
        }

        use {
            'neoclide/coc.nvim',
            branch = 'release',
            config = [[require('plugins.coc')]],
            event = 'VimEnter'
        }

        use {
            'ThePrimeagen/harpoon',
            config = function()
                require("harpoon").setup({
                    global_settings = {
                        save_on_toggle = false,
                        save_on_change = true,
                        enter_on_sendcmd = false,
                    },
                    projects = {
                        ["~\\Appdata\\Local\\nvim"] = {
                            term = {
                                cmds = {
                                    "ungit"
                                }
                            }
                        }
                    }
                })
            end
        }

        use {
            'lewis6991/gitsigns.nvim',
            requires = {
                'nvim-lua/plenary.nvim'
            },
            config = [[require('gitsigns').setup()]]
        }

    end)

end

return M
Thanks a lot for your time and have a nice day ! (:
@vzytoi vzytoi added the bug label Nov 18, 2021
@wbthomason
Copy link
Owner

That does look like a pretty slow startup time. However, based on the fact that your config spends 160ms in loading tabnine, I'm suspicious that the long load time for packer_compiled is due to loading your tabnine config. What happens when you disable that plugin?

@mrjones2014
Copy link

I'm also getting super slow startup all of a sudden, and it's only packer_compiled.lua that's taking a while. is there a way to profile what it's doing?

       startup: 738.7
event                  time percent plot
packer_compiled.lua  680.68   92.15 ██████████████████████████
filetype.vim           7.76    1.05 ▎
init.lua               7.04    0.95 ▎
loading packages       5.40    0.73 ▎
cmp.lua                4.40    0.60 ▏
loading rtp plugins    4.06    0.55 ▏
first screen update    3.87    0.52 ▏
reading ShaDa          3.45    0.47 ▏
parsing arguments      3.42    0.46 ▏
sourcing vimrc file(   2.85    0.39 ▏
VimEnter autocommand   2.07    0.28 ▏
done waiting for UI    1.94    0.26 ▏
dash.vim               1.46    0.20
nvim-treesitter.vim    1.40    0.19
opening buffers        1.30    0.18
nvim-treesitter-text   1.25    0.17
expanding arguments    1.18    0.16
loading after plugin   1.10    0.15
matchit.vim            0.89    0.12
locale set             0.70    0.09
init highlight         0.60    0.08
cmp_path.lua           0.52    0.07
syntax.vim             0.47    0.06
inits 1                0.43    0.06
dressing.lua           0.41    0.06
cmp_buffer.lua         0.39    0.05
netrwPlugin.vim        0.31    0.04
sleuth.vim             0.28    0.04
before starting main   0.23    0.03
move.vim               0.21    0.03
indent_blankline.vim   0.21    0.03
cmp_luasnip.lua        0.20    0.03
rplugin.vim            0.19    0.03
rainbow.vim            0.19    0.03
eunuch.vim             0.19    0.03
tldr.vim               0.18    0.02
cmp_nvim_lsp_signatu   0.17    0.02
matchit.vim            0.17    0.02
luasnip.vim            0.16    0.02
gzip.vim               0.14    0.02
matchparen.vim         0.13    0.02
cmp_nvim_lua.lua       0.13    0.02
zipPlugin.vim          0.12    0.02
clipboard.vim          0.12    0.02
startuptime.vim        0.11    0.01
tarPlugin.vim          0.10    0.01
nvim-tree-startup.lu   0.09    0.01
init default autocom   0.09    0.01
tohtml.vim             0.08    0.01
telescope.vim          0.08    0.01
shada.vim              0.07    0.01
tagalong.vim           0.07    0.01
synload.vim            0.06    0.01
ftplugin.vim           0.06    0.01
legendary.lua          0.06    0.01
BufEnter autocommand   0.06    0.01
man.vim                0.05    0.01
autocmds.vim           0.04    0.01
trouble.vim            0.04    0.01
cmp_nvim_lsp.lua       0.04    0.01
lspconfig.vim          0.04    0.01
filetype.lua           0.04    0.00
indent.vim             0.04    0.00
fish.vim               0.04    0.00
inits 2                0.03    0.00
bufdelete.vim          0.03    0.00
init default mapping   0.03    0.00
query.vim              0.02    0.00
spellfile.vim          0.02    0.00
nvim-web-devicons.vi   0.02    0.00
plenary.vim            0.02    0.00
graphql.vim            0.02    0.00
tlaplus.vim            0.02    0.00
tutor.vim              0.02    0.00
colorizer.vim          0.02    0.00
ql.vim                 0.02    0.00
surface.vim            0.02    0.00
todo.vim               0.02    0.00
executing command ar   0.02    0.00
jsonc.vim              0.02    0.00
hcl.vim                0.02    0.00
ledger.vim             0.02    0.00
yang.vim               0.02    0.00
prisma.vim             0.02    0.00
teal.vim               0.02    0.00
nix.vim                0.02    0.00
rplugin.vim            0.02    0.00
hack.vim               0.02    0.00
json5.vim              0.02    0.00
pug.vim                0.02    0.00
window checked         0.01    0.00
gdresource.vim         0.01    0.00
heex.vim               0.01    0.00
hjson.vim              0.01    0.00
gowork.vim             0.01    0.00
health.vim             0.01    0.00
snippets.vim           0.01    0.00
fusion.vim             0.01    0.00
gdscript.vim           0.01    0.00
glimmer.vim            0.01    0.00
glsl.vim               0.01    0.00
inits 3                0.01    0.00
--- NVIM STARTING --   0.01    0.00
init screen for UI     0.01    0.00
UIEnter autocommands   0.00    0.00
waiting for UI         0.00    0.00
editing files in win   0.00    0.00
--- NVIM STARTED ---   0.00    0.00

@mrjones2014
Copy link

Nevermind, I figured out my issue and it was me doing something dumb in my config.

@msva
Copy link

msva commented Apr 28, 2022

@mrjones2014 can you elaborate a bit about "something dumb"?
I'm having packer_compiled.lua as top1 time sonsumer, but I don't think that anything in my config is dumb 🤷

@mrjones2014
Copy link

I have sumneko lua LSP installed via brew on Mac, and I was using a brew command to dynamically get the version to put into lspconfig (since lua-language-server --version was printing unknown for me, not sure if that's just me or a known issue), and brew is very slow.

I changed it to use ls and grep to get the version instead, which is a lot faster, and I'm also lazy-loading LSP configs with autocommands, based on filetype (e.g. sumneko lua gets loaded only if I open a lua file). See dotfiles: https://github.com/mrjones2014/dotfiles/blob/master/.config/nvim/lua/lsp/init.lua#L31-L50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants