Skip to content

Commit

Permalink
fix: lazy.nvim should not notify error "Plugin ... is not installed" …
Browse files Browse the repository at this point in the history
…on startup
  • Loading branch information
adoyle-h committed Jul 2, 2023
1 parent 91e326e commit ec03056
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lua/one/plugin-manager/lazy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ local function parseOpts(repo, opts)
return plugOpts
end

-- 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

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

-- @param params see lua/one/plugin-manager/init.lua
function P.setup(params)
local config = params.config
Expand All @@ -48,6 +60,8 @@ function P.setup(params)

local lazy = require('lazy')

silentNotifyPluginUninstall()

local plugins = {}

P.loadPlug = function(repo, opts)
Expand Down

0 comments on commit ec03056

Please sign in to comment.