update to nvim 0.9

This commit is contained in:
veypi
2023-09-12 18:55:10 +08:00
parent 1349868048
commit e53c7aa336
8 changed files with 66 additions and 97 deletions
+28 -21
View File
@@ -9,23 +9,26 @@ 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
_G._packer = _G._packer or {}
_G._packer.inside_compile = true
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
else
time = function(chunk, start) 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
@@ -38,8 +41,10 @@ local function save_profiles(threshold)
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
end
end
if threshold then
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
end
_G._packer = _G._packer or {}
_G._packer.profile_output = results
end
@@ -69,11 +74,6 @@ end
time([[try_loadstring definition]], false)
time([[Defining packer_plugins]], true)
_G.packer_plugins = {
["AutoSave.nvim"] = {
loaded = true,
path = "/Users/veypi/.local/share/nvim/site/pack/packer/start/AutoSave.nvim",
url = "https://github.com/Pocco81/AutoSave.nvim"
},
["Comment.nvim"] = {
loaded = true,
path = "/Users/veypi/.local/share/nvim/site/pack/packer/start/Comment.nvim",
@@ -232,6 +232,13 @@ _G.packer_plugins = {
}
time([[Defining packer_plugins]], false)
_G._packer.inside_compile = false
if _G._packer.needs_bufread == true then
vim.cmd("doautocmd BufRead")
end
_G._packer.needs_bufread = false
if should_profile then save_profiles() end
end)