mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
feat(toggle): add more M.wk fields for better user customization
This commit is contained in:
parent
a1c3ec4cd4
commit
2f8371588c
1 changed files with 5 additions and 1 deletions
|
|
@ -3,6 +3,9 @@ local M = {}
|
|||
|
||||
---@class lazyvim.Toggle
|
||||
---@field name string
|
||||
---@field icon? string
|
||||
---@field color_enabled? string
|
||||
---@field color_disabled? string
|
||||
---@field get fun():boolean
|
||||
---@field set fun(state:boolean)
|
||||
|
||||
|
|
@ -50,7 +53,8 @@ function M.wk(lhs, toggle)
|
|||
{
|
||||
lhs,
|
||||
icon = function()
|
||||
return safe_get() and { icon = " ", color = "green" } or { icon = " ", color = "yellow" }
|
||||
return safe_get() and { icon = toggle.icon or " ", color = toggle.color_enabled or "green" }
|
||||
or { icon = toggle.icon or " ", color = toggle.color_disabled or "yellow" }
|
||||
end,
|
||||
desc = function()
|
||||
return (safe_get() and "Disable " or "Enable ") .. toggle.name
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue