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

ZenMode Closes when changing pane (`<c-w><c-h>` etc.)

Open JoshuaCrewe opened this issue 3 years ago • 1 comments

This is probably by design, from the README.md :

Zen Mode is automatically closed when a new non-floating window is opened

But I thought I would open up the discussion to check if there is anything which can be done.

My use case

I use ZenMode almost exclusively for writing markdown files. nine times out of ten I have one window open with one pane that is the blog post or markdown file I am working on. I launch vim directly into ZenMode with an au command.

<c-h,j,k,l> is configured to move vim splits as well as move between tmux panes ( vim-tmux-navigator )

At the moment if I launch ZenMode and move to a new tmux pane (or muscle memory make me try to even if one isn't there), ZenMode exits out. If there was a way of capturing focus so ZenMode wouldn't exit when it is the only thing open that would be good.

tldr;

Vim with one buffer in ZenMode I would like to stop ZenMode exiting when accidentally moving to a new pane (which may not even exist!

(I hope this makes sense)

JoshuaCrewe avatar Sep 28 '22 15:09 JoshuaCrewe

  -- TODO: when the cursor leaves the window, we close zen mode, or prevent leaving the window

lua/zen-mode/view.lua

I think this might be what I am looking for. A focus trap for Zen Mode.

JoshuaCrewe avatar Oct 05 '22 07:10 JoshuaCrewe

This behaviour regularly bites me when switching between windows. Using macOS, I have Neovim with ZenMode active in a terminal window. When I switch (for example) to a browser, copy something, and switch back by clicking the terminal window, ZenMode gets closed.

I found that it's the margins created by ZenMode, not the entire window. Whenever I do this and click in the area of the text, it stays enabled. Whenever I click the blank margins, it closes.

I don't know if this is directly related to the open TODO but thought I'd mention it. Not a show stopper but mildly annoying when encountered repeatedly.

herrbischoff avatar Mar 17 '23 14:03 herrbischoff

this is by design

folke avatar Mar 17 '23 14:03 folke

@folke Thanks for clarifying.

herrbischoff avatar Mar 17 '23 14:03 herrbischoff