Closed FOSSilizedDaemon closed 3 months ago
You could do :qa
instead?
I had the same problem as @FOSSilizedDaemon: when I execute :q
, rather than exiting zen mode, I wish to quit the buffer (and hide it, as I use set hidden
). Using :qa
doesn't solve the problem because it will close all buffers and close vim (instead of just quitting the buffer I'm editing).
To get this to work, I learned from this related code for the goyo plugin, and added this code to the zen mode callbacks:
require("zen-mode").setup {
on_open = function(_)
vim.cmd 'cabbrev <buffer> q let b:quitting = 1 <bar> q'
vim.cmd 'cabbrev <buffer> wq let b:quitting = 1 <bar> wq'
end,
on_close = function()
if vim.b.quitting == 1 then
vim.b.quitting = 0
vim.cmd 'q'
end
end,
}
@folke why doesn't zen mode automatically exit plugins with :q
? I think that would be useful so that :q
still works the same as in regular buffers, and then :ZenMode
is the command used to toggle zen mode.
P.S. The easiest solution is to just use :bdelete
instead of :q
, however with that I get a segmentation fault in my current nvim configuration. I won't open an new issue for that segmentation error because I couldn't reliably reproduce it with a mini.vim
configuration.
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.
I noticed that
zen-mode
simply untoggles itself when exiting a buffer runningzen-mode
with:q
. This seems to be common in Goyo-like plugins, but as I usezen-mode
for mainly writing this leads to me having to exit twice. Is there any official way to have:q
andZQ
and such exitzen-mode
instead of toggling it?