Toggle keymaps integrated with which-key icons / colors
---@class snacks.toggle.Config
---@field icon? string|{ enabled: string, disabled: string }
---@field color? string|{ enabled: string, disabled: string }
{
map = vim.keymap.set, -- keymap.set function to use
which_key = true, -- integrate with which-key to show enabled/disabled icons and colors
notify = true, -- show a notification when toggling
-- icons for enabled/disabled states
icon = {
enabled = " ",
disabled = " ",
},
-- colors for enabled/disabled states
color = {
enabled = "green",
disabled = "yellow",
},
}
---@class snacks.toggle.Opts: snacks.toggle.Config
---@field name string
---@field get fun():boolean
---@field set fun(state:boolean)
---@class snacks.toggle
---@field opts snacks.toggle.Opts
Snacks.toggle = {}
---@type fun(... :snacks.toggle.Opts): snacks.toggle
Snacks.toggle()
---@param opts? snacks.toggle.Config
Snacks.toggle.diagnostics(opts)
---@param opts? snacks.toggle.Config
Snacks.toggle.inlay_hints(opts)
---@param opts? snacks.toggle.Config
Snacks.toggle.line_number(opts)
---@param ... snacks.toggle.Opts
---@return snacks.toggle
Snacks.toggle.new(...)
---@param option string
---@param opts? snacks.toggle.Config | {on?: unknown, off?: unknown}
Snacks.toggle.option(option, opts)
---@param opts? snacks.toggle.Config
Snacks.toggle.treesitter(opts)
toggle:get()
---@param keys string
---@param opts? vim.keymap.set.Opts | { mode: string|string[]}
toggle:map(keys, opts)
---@param state boolean
toggle:set(state)
toggle:toggle()