diff options
| author | Evgeni Chasnovski <evgeni.chasnovski@gmail.com> | 2025-12-28 18:07:32 +0200 |
|---|---|---|
| committer | Evgeni Chasnovski <evgeni.chasnovski@gmail.com> | 2025-12-28 18:39:26 +0200 |
| commit | c339b83a4ab99d170776b01c4e4ca4e550f45bba (patch) | |
| tree | 0318ee32fd6a248e143e21cb2165b442efbad6ef /runtime/lua/vim/pack.lua | |
| parent | f5707a9c42a6f0efd0d7abaa1e5caf62eab21aea (diff) | |
feat(pack): hint in confirmation buffer that plugin is not active
Problem: After `vim.pack.update()` it is not clear if plugin is active
or not. This can be useful to detect cases when plugin was removed
from 'init.lua' but there was no `vim.pack.del()`.
Solution: Add ` (not active)` suffix with distinctive highlighting to
header of plugins that are not active.
It will also be shown in in-process LSP document symbols to have quick
reference about which plugins are not active.
Diffstat (limited to 'runtime/lua/vim/pack.lua')
| -rw-r--r-- | runtime/lua/vim/pack.lua | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/runtime/lua/vim/pack.lua b/runtime/lua/vim/pack.lua index 775f26ddf6..1ed9fd042f 100644 --- a/runtime/lua/vim/pack.lua +++ b/runtime/lua/vim/pack.lua @@ -990,11 +990,12 @@ end --- @param p vim.pack.Plug --- @return string local function compute_feedback_lines_single(p) + local active_suffix = active_plugins[p.path] ~= nil and '' or ' (not active)' if p.info.err ~= '' then - return ('## %s\n\n %s'):format(p.spec.name, p.info.err:gsub('\n', '\n ')) + return ('## %s%s\n\n %s'):format(p.spec.name, active_suffix, p.info.err:gsub('\n', '\n ')) end - local parts = { '## ' .. p.spec.name .. '\n' } + local parts = { ('## %s%s\n'):format(p.spec.name, active_suffix) } local version_suffix = p.info.version_str == '' and '' or (' (%s)'):format(p.info.version_str) if p.info.sha_head == p.info.sha_target then @@ -1127,7 +1128,7 @@ local function get_update_map(bufnr) for _, l in ipairs(lines) do local name = l:match('^## (.+)$') if name and is_in_update then - res[name] = true + res[name:gsub(' %(not active%)$', '')] = true end local group = l:match('^# (%S+)') |
