[NVIM] Keep update notices visible
This commit is contained in:
@@ -97,8 +97,21 @@ local function check_plugin_updates()
|
||||
return command
|
||||
end
|
||||
|
||||
local function set_airline_status(message)
|
||||
vim.g.plugin_update_status = message
|
||||
local marker = '%{get(g:,"plugin_update_status","")}'
|
||||
local warning = vim.g.airline_section_warning or ''
|
||||
if not string.find(warning, 'plugin_update_status', 1, true) then
|
||||
vim.g.airline_section_warning = warning .. ' ' .. marker
|
||||
end
|
||||
if vim.fn.exists(':AirlineRefresh') == 2 then
|
||||
vim.cmd('AirlineRefresh')
|
||||
end
|
||||
end
|
||||
|
||||
local function report()
|
||||
if #updates > 0 then
|
||||
set_airline_status(string.format('[updates: %d]', #updates))
|
||||
local message = string.format(
|
||||
'%d plugin update%s available: %s',
|
||||
#updates,
|
||||
@@ -110,11 +123,13 @@ local function check_plugin_updates()
|
||||
end
|
||||
vim.notify(message, failures > 0 and vim.log.levels.WARN or vim.log.levels.INFO)
|
||||
elseif failures > 0 then
|
||||
set_airline_status('[update check failed]')
|
||||
vim.notify(
|
||||
string.format('Plugin update check incomplete: %d check%s failed', failures, failures == 1 and '' or 's'),
|
||||
vim.log.levels.WARN
|
||||
)
|
||||
else
|
||||
set_airline_status('')
|
||||
vim.notify('All plugins up-to-date', vim.log.levels.INFO)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user