[NVIM] Keep update notices visible
This commit is contained in:
@@ -133,8 +133,21 @@ local function check_plugin_updates()
|
|||||||
return command
|
return command
|
||||||
end
|
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()
|
local function report()
|
||||||
if #updates > 0 then
|
if #updates > 0 then
|
||||||
|
set_airline_status(string.format('[updates: %d]', #updates))
|
||||||
local message = string.format(
|
local message = string.format(
|
||||||
'%d plugin update%s available: %s',
|
'%d plugin update%s available: %s',
|
||||||
#updates,
|
#updates,
|
||||||
@@ -146,11 +159,13 @@ local function check_plugin_updates()
|
|||||||
end
|
end
|
||||||
vim.notify(message, failures > 0 and vim.log.levels.WARN or vim.log.levels.INFO)
|
vim.notify(message, failures > 0 and vim.log.levels.WARN or vim.log.levels.INFO)
|
||||||
elseif failures > 0 then
|
elseif failures > 0 then
|
||||||
|
set_airline_status('[update check failed]')
|
||||||
vim.notify(
|
vim.notify(
|
||||||
string.format('Plugin update check incomplete: %d check%s failed', failures, failures == 1 and '' or 's'),
|
string.format('Plugin update check incomplete: %d check%s failed', failures, failures == 1 and '' or 's'),
|
||||||
vim.log.levels.WARN
|
vim.log.levels.WARN
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
|
set_airline_status('')
|
||||||
vim.notify('All plugins up-to-date', vim.log.levels.INFO)
|
vim.notify('All plugins up-to-date', vim.log.levels.INFO)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user