mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
feat(zen): added center option that defaults to true for zen mode and false for zoom mode. Closes #2422
This commit is contained in:
parent
da14fac1e5
commit
3c2d79162f
1 changed files with 8 additions and 1 deletions
|
|
@ -23,6 +23,7 @@ local defaults = {
|
|||
-- diagnostics = false,
|
||||
-- inlay_hints = false,
|
||||
},
|
||||
center = true, -- center the window
|
||||
show = {
|
||||
statusline = false, -- can only be shown when using the global statusline
|
||||
tabline = false,
|
||||
|
|
@ -39,6 +40,7 @@ local defaults = {
|
|||
---@type snacks.zen.Config
|
||||
zoom = {
|
||||
toggles = {},
|
||||
center = false,
|
||||
show = { statusline = true, tabline = true },
|
||||
win = {
|
||||
backdrop = false,
|
||||
|
|
@ -145,8 +147,13 @@ function M.zen(opts)
|
|||
|
||||
-- create window
|
||||
local win = Snacks.win(win_opts)
|
||||
if vim.bo[buf].buftype ~= "terminal" then
|
||||
if opts.center and vim.bo[buf].buftype ~= "terminal" then
|
||||
vim.cmd([[norm! zz]])
|
||||
else
|
||||
local view = vim.api.nvim_win_call(parent_win, vim.fn.winsaveview)
|
||||
vim.api.nvim_win_call(win.win, function()
|
||||
vim.fn.winrestview(view)
|
||||
end)
|
||||
end
|
||||
M.win = win
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue