Skip to content

Commit

Permalink
fix: lazy.core.util.error should be reset
Browse files Browse the repository at this point in the history
  • Loading branch information
adoyle-h committed Sep 27, 2023
1 parent 8755c30 commit 20734f5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lua/one/plugin-manager/lazy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,25 @@ local function parseOpts(repo, opts)
return plugOpts
end

local errorNotify

-- Lazy.nvim always notify "Plugin ... is not installed" on startup.
-- https://github.com/folke/lazy.nvim/blob/f8611632d0f9c6818e8eb54f9bcd1dad122b5a7f/lua/lazy/core/loader.lua#L297
-- I want to trigger the notification via nvim-notify after startup.
local function silentNotifyPluginUninstall()
local lazyUtil = require('lazy.core.util')
local errorNotify = lazyUtil.error
errorNotify = lazyUtil.error

lazyUtil.error = function(msg, opts)
if not string.match(msg, '^Plugin [-._a-zA-Z0-9]+ is not installed$') then errorNotify(msg, opts) end
end
end

local function unsilentNotifyPluginUninstall()
local lazyUtil = require('lazy.core.util')
lazyUtil.error = errorNotify
end

-- @param params see lua/one/plugin-manager/init.lua
function P.setup(params)
local config = params.config
Expand Down Expand Up @@ -85,6 +92,8 @@ function P.setup(params)

lazy.setup(plugins, lazyConfig)

unsilentNotifyPluginUninstall()

return isNew
end

Expand Down

0 comments on commit 20734f5

Please sign in to comment.