bug: Switching buffers while in ZenMode doesn't apply ZenMode options
Did you check docs and existing issues?
- [X] I have read all the zen-mode.nvim docs
- [X] I have searched the existing issues of zen-mode.nvim
- [X] I have searched the existing issues of plugins related to this issue
Neovim version (nvim -v)
NVIM v0.10.0-dev-664+g0ce391086
Operating system/version
MacOS 13.4
Describe the bug
Switching buffers while in ZenMode doesn't apply zen-mode options.
There is also this strange issue where ZenMode does apply zen-mode options when switching to certain buffers, but the original options for those buffers are not restored upon exiting ZenMode, though I haven't been able to trace the root cause as it is rather inconsistent. (I think it may be lsp-related, as it only happens on buffers that lsps like lua_ls and tsserver attach to, but I'm not entirely sure).
As you can see from the example, ZenMode options are applied to all buffers except the one with 2.lua opened, which is the only one that has its original line number column restored upon exiting ZenMode.
Steps To Reproduce
- Toggle ZenMode
- Open new buffers
- ZenMode options are not applied to new buffers
Expected Behavior
I would expect that ZenMode options are applied when switching between buffers while ZenMode is enabled, and that the original buffer options (signcolumn, line numbers, etc.) are properly restored disabling ZenMode.
Repro
-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.runtimepath:prepend(lazypath)
vim.keymap.set("n", "H", "<cmd>bprev<cr>")
vim.keymap.set("n", "L", "<cmd>bnext<cr>")
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.foldcolumn = "2"
vim.opt.signcolumn = "yes"
-- install plugins
local plugins = {
"folke/tokyonight.nvim",
{
"folke/zen-mode.nvim",
cmd = "ZenMode",
opts = {
window = {
backdrop = 1,
width = function()
return math.min(120, vim.o.columns * 0.75)
end,
height = 0.9,
options = {
number = false,
relativenumber = false,
foldcolumn = "0",
list = false,
showbreak = "NONE",
signcolumn = "no",
},
},
plugins = {
options = {
cmdheight = 1,
laststatus = 0,
},
},
},
},
-- add any other plugins here
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- add anything else here
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been stalled for 7 days with no activity.