Zen mode • distraction-free coding.
Integrates with Snacks.toggle
to toggle various UI elements
and with Snacks.dim
to dim code out of scope.
Similar plugins:
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
zen = {
-- your zen configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
---@class snacks.zen.Config
{
-- You can add any `Snacks.toggle` id here.
-- Toggle state is restored when the window is closed.
-- Toggle config options are NOT merged.
---@type table<string, boolean>
toggles = {
dim = true,
git_signs = false,
mini_diff_signs = false,
-- diagnostics = false,
-- inlay_hints = false,
},
show = {
statusline = false, -- can only be shown when using the global statusline
tabline = false,
},
---@type snacks.win.Config
win = { style = "zen" },
--- Callback when the window is opened.
---@param win snacks.win
on_open = function(win) end,
--- Callback when the window is closed.
---@param win snacks.win
on_close = function(win) end,
--- Options for the `Snacks.zen.zoom()`
---@type snacks.zen.Config
zoom = {
toggles = {},
show = { statusline = true, tabline = true },
win = {
backdrop = false,
width = 0, -- full width
},
},
}
Check the styles docs for more information on how to customize these styles
{
enter = true,
fixbuf = false,
minimal = false,
width = 120,
height = 0,
backdrop = { transparent = true, blend = 40 },
keys = { q = false },
zindex = 40,
wo = {
winhighlight = "NormalFloat:Normal",
},
}
fullscreen indicator only shown when the window is maximized
{
text = "▍ zoom ",
minimal = true,
enter = false,
focusable = false,
height = 1,
row = 0,
col = -1,
backdrop = false,
}
---@type fun(opts: snacks.zen.Config): snacks.win
Snacks.zen()
---@param opts? snacks.zen.Config
Snacks.zen.zen(opts)
---@param opts? snacks.zen.Config
Snacks.zen.zoom(opts)