mirror of https://github.com/folke/lazy.nvim.git
feat(view): add option `ui.pills`. Set to `false` to disable the top buttons in the lazy window (#938)
* add option `ui.button` * add option `ui.button` * refactor: rename button to pills --------- Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
This commit is contained in:
parent
25beed5e2e
commit
84266b9f0f
|
@ -339,6 +339,8 @@ return {
|
||||||
border = "none",
|
border = "none",
|
||||||
title = nil, ---@type string only works when border is not "none"
|
title = nil, ---@type string only works when border is not "none"
|
||||||
title_pos = "center", ---@type "center" | "left" | "right"
|
title_pos = "center", ---@type "center" | "left" | "right"
|
||||||
|
-- Show pills on top of the Lazy window
|
||||||
|
pills = true, ---@type boolean
|
||||||
icons = {
|
icons = {
|
||||||
cmd = " ",
|
cmd = " ",
|
||||||
config = "",
|
config = "",
|
||||||
|
|
|
@ -50,6 +50,8 @@ M.defaults = {
|
||||||
border = "none",
|
border = "none",
|
||||||
title = nil, ---@type string only works when border is not "none"
|
title = nil, ---@type string only works when border is not "none"
|
||||||
title_pos = "center", ---@type "center" | "left" | "right"
|
title_pos = "center", ---@type "center" | "left" | "right"
|
||||||
|
-- Show pills on top of the Lazy window
|
||||||
|
pills = true, ---@type boolean
|
||||||
icons = {
|
icons = {
|
||||||
cmd = " ",
|
cmd = " ",
|
||||||
config = "",
|
config = "",
|
||||||
|
|
|
@ -112,38 +112,41 @@ function M:get_plugin(row)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:title()
|
function M:title()
|
||||||
self:nl():nl()
|
self:nl()
|
||||||
local modes = vim.tbl_filter(function(c)
|
local modes = vim.tbl_filter(function(c)
|
||||||
return c.button
|
return c.button
|
||||||
end, ViewConfig.get_commands())
|
end, ViewConfig.get_commands())
|
||||||
|
|
||||||
for c, mode in ipairs(modes) do
|
if Config.options.ui.pills then
|
||||||
local title = " " .. mode.name:sub(1, 1):upper() .. mode.name:sub(2) .. " (" .. mode.key .. ") "
|
self:nl()
|
||||||
if mode.name == "home" then
|
for c, mode in ipairs(modes) do
|
||||||
if self.view.state.mode == "home" then
|
local title = " " .. mode.name:sub(1, 1):upper() .. mode.name:sub(2) .. " (" .. mode.key .. ") "
|
||||||
title = " lazy.nvim " .. Config.options.ui.icons.lazy
|
|
||||||
else
|
|
||||||
title = " lazy.nvim (H) "
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if self.view.state.mode == mode.name then
|
|
||||||
if mode.name == "home" then
|
if mode.name == "home" then
|
||||||
self:append(title, "LazyH1", { wrap = true })
|
if self.view.state.mode == "home" then
|
||||||
|
title = " lazy.nvim " .. Config.options.ui.icons.lazy
|
||||||
|
else
|
||||||
|
title = " lazy.nvim (H) "
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.view.state.mode == mode.name then
|
||||||
|
if mode.name == "home" then
|
||||||
|
self:append(title, "LazyH1", { wrap = true })
|
||||||
|
else
|
||||||
|
self:append(title, "LazyButtonActive", { wrap = true })
|
||||||
|
self:highlight({ ["%(.%)"] = "LazySpecial" })
|
||||||
|
end
|
||||||
else
|
else
|
||||||
self:append(title, "LazyButtonActive", { wrap = true })
|
self:append(title, "LazyButton", { wrap = true })
|
||||||
self:highlight({ ["%(.%)"] = "LazySpecial" })
|
self:highlight({ ["%(.%)"] = "LazySpecial" })
|
||||||
end
|
end
|
||||||
else
|
if c == #modes then
|
||||||
self:append(title, "LazyButton", { wrap = true })
|
break
|
||||||
self:highlight({ ["%(.%)"] = "LazySpecial" })
|
end
|
||||||
|
self:append(" ")
|
||||||
end
|
end
|
||||||
if c == #modes then
|
self:nl()
|
||||||
break
|
|
||||||
end
|
|
||||||
self:append(" ")
|
|
||||||
end
|
end
|
||||||
self:nl()
|
|
||||||
if self.progress.done < self.progress.total then
|
if self.progress.done < self.progress.total then
|
||||||
self:progressbar()
|
self:progressbar()
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue