Method For Quitting When Closing ZenMode Window?
Hello,
I use nvim for mostly writing not coding and am interested in using this plugin to have a more word processor feel when writing. The one big annoyance I have with using this plugin is that when I close the ZenMode window or use :q to exit it just toggles the ZenMode window instead of exiting from nvim. Is there any way to make it so that nvim exits instead of just toggling the window?
What if you write :qa?
Hi @FOSSilizedDaemon, It's a bit of a hack but you can stick the following into your into your Zen Mode 🧘 config:
require("zenmode").setup({
-- Your existing config:
...
-- At the end of the file add this:
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,
})
This temporarily redefines :q and :wq to set the 'quitting' variable to 1. And if the 'quitting' variable is set to one, then the on_close function quits neovim for you.
I had tried "autocmd WinLeave
I think the above would work if it could be turned on and off. Maybe adding a command that will enable the aboveZenModeWordProcess and then you could start vim with nvim +"ZenModeWordProcess" +"ZenMode"