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

Added line to keep cursor position when leaving zen-mode.

Open nasanos opened this issue 4 years ago • 4 comments

See issue #19.

nasanos avatar Sep 23 '21 21:09 nasanos

I've tested and it works. I activate zen when entering Insert Mode and deactivate it on leaving. Kudos to you, I'm no longer going insane. :-)

mystilleef avatar Oct 16 '21 18:10 mystilleef

@nasanos Would it be possible to update this to also synchronize the scroll position? As it is now, I'm guessing it's possible for the cursor to be at the top of the Zen window, then at the bottom of the original window when exiting Zen mode.

Synchronizing the scroll position would be a nice touch, making it slightly less jarring to return to the original window, as the windows would look identical (at least if they were the same height.)

Hubro avatar Jul 28 '22 12:07 Hubro

@Hubro I definitely like that idea, and, from what I recall, I think it would be doable, though I need to look through the code again to be sure. Other responsibilities mean it may take me a while, but I can start looking into what it would take to add that feature as well.

nasanos avatar Aug 03 '22 19:08 nasanos

@nasanos If you want to go all the way, you could continuously keep the cursor position and scroll position in sync with the original window using autocommands. I know there are events both for cursor move and window scroll, so it's definitely doable. The advantage of this would be that plugins that depend on the scroll position, such as nvim-scrollview, would keep working.

Hubro avatar Aug 03 '22 19:08 Hubro

:tada:

Hubro avatar Sep 05 '22 09:09 Hubro