Skip to content

Commit

Permalink
feat(ui): added section with disabled plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jan 3, 2023
1 parent 05aec48 commit 299ffdf
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions lua/lazy/core/plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ function Spec:add(plugin, results, is_dep)
self.plugins[plugin.name] = plugin
return results and table.insert(results, plugin.name)
else
plugin._.kind = "disabled"
self.disabled[plugin.name] = plugin
self.plugins[plugin.name] = nil
end
Expand Down
4 changes: 3 additions & 1 deletion lua/lazy/help.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ function M.index(plugin)
end

function M.update()
vim.cmd.helptags(Config.plugins["lazy.nvim"].dir .. "/doc")
if Config.plugins["lazy.nvim"] then
vim.cmd.helptags(Config.plugins["lazy.nvim"].dir .. "/doc")
end
local docs = Config.options.readme.root .. "/doc"
vim.fn.mkdir(docs, "p")

Expand Down
2 changes: 1 addition & 1 deletion lua/lazy/types.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

---@alias LazyPluginKind "normal"|"clean"
---@alias LazyPluginKind "normal"|"clean"|"disabled"

---@class LazyPluginState
---@field loaded? {[string]:string}|{time:number}
Expand Down
3 changes: 3 additions & 0 deletions lua/lazy/view/render.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ function M:update()

self.plugins = vim.tbl_values(Config.plugins)
vim.list_extend(self.plugins, vim.tbl_values(Config.to_clean))
vim.list_extend(self.plugins, vim.tbl_values(Config.spec.disabled))
table.sort(self.plugins, function(a, b)
return a.name < b.name
end)
Expand Down Expand Up @@ -99,6 +100,8 @@ function M:get_plugin(row)
return plugin
end
end
elseif loc.kind == "disabled" then
return Config.spec.disabled[loc.name]
else
return Config.plugins[loc.name]
end
Expand Down
8 changes: 7 additions & 1 deletion lua/lazy/view/sections.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ return {
},
{
filter = function(plugin)
return not plugin._.installed
return not plugin._.installed and plugin._.kind ~= "disabled"
end,
title = "Not Installed",
},
Expand All @@ -99,4 +99,10 @@ return {
end,
title = "Not Loaded",
},
{
filter = function(plugin)
return plugin._.kind == "disabled"
end,
title = "Disabled",
},
}

0 comments on commit 299ffdf

Please sign in to comment.