zen-mode.nvim icon indicating copy to clipboard operation
zen-mode.nvim copied to clipboard

feature: ZenMode as default option

Open j-o-sh opened this issue 1 year ago • 3 comments

Did you check the docs?

  • [X] I have read all the zen-mode.nvim docs

Is your feature request related to a problem? Please describe.

I am trying to figure out how to have ZenMode behave like a default option of nvim. Since it launches into a new floating buffer, obvioulsy, :q does now quit the ZenMode buffer and puts you back into the buffer vim started in.

This leads to a strange UX when using ZenMode as the only way to work in vim, since you start always exiting twice.

Describe the solution you'd like

Is there a way to have ZenMode override the current buffer instead of creating a new one?

Essentially I would like to have an option (say: opts = { default = true }) that would 1. replace the current buffer instead of opening a new floating one and 2. start ZenMode immediately with NVim.

Is there a way that I could script this into my config? Or is that maybe an option you would consider adding?

Thx, Josh

Describe alternatives you've considered

Additional context

No response

j-o-sh avatar Aug 25 '23 14:08 j-o-sh

If possible, it would be nice to enable this on a per file-type basis. I'd like to have "text" files, for example, opened directly in Zen Mode, when I open Neovim.

tmaxmax avatar Nov 14 '23 22:11 tmaxmax

This is relatively easy to achieve independently, with a relatively simple set of config options.

In autocommands.lua

vim.api.nvim_create_autocmd({ "BufEnter" }, {
  pattern = { "*.py", "*.lua" },
  callback = require("zen-mode").open,
})
vim.api.nvim_create_autocmd({ "BufLeave" }, {
  pattern = { "*.py", "*.lua" },
  callback = require("zen-mode").close,
})

I also like to use neotree so I rebound e, because it opens a window and there are some unusual behaviours.

vim.keymap.set("n", "<leader>e", function()
  require("zen-mode").toggle()
  vim.cmd("Neotree toggle")
end, { desc = "Toggle Neotree" })

I hope this helps.

seancraven avatar Dec 29 '23 19:12 seancraven