pocco81 / true-zen.nvim

🦝 Clean and elegant distraction-free writing for NeoVim
GNU General Public License v3.0
976 stars 28 forks source link

[BUG] Inconsistent Closing of Entire Tab Using `TZFocus` #101

Open TheCedarPrince opened 2 years ago

TheCedarPrince commented 2 years ago

Hi folks!

I am trying to track down a bug right now (at least, it seems like a bug) where when using "TZFocus", the buffer of interest gets focused from a given tab into a new tab, but sometimes when I close the buffer that was made using "TZFocus", the tab which it originated from closes completely. It is a bit of a nuisance as sometimes I have a nice layout in my tab made for a particular project I am doing and then I have to recreate it. What could I do to either stop this behavior or report back further details about this issue (new to the Neovim lua plugin space)?

Thanks!

~ tcp :deciduous_tree:

loqusion commented 2 years ago

What are you using to close the buffer?

TheCedarPrince commented 2 years ago

@loqusion - I use :TZFocus to open up the file in a "focused" buffer and then :TZFocus to close it to bring me back to my tab which is what I thought was the correct usage.

loqusion commented 2 years ago

All :TZFocus really does is run any configured callbacks and run :tab split or :tabclose depending on whether it's running or not, so that's kind of weird. Do you have a neovim config or snippet that can reproduce the issue?

TheCedarPrince commented 2 years ago

This is where I am confused as I am not sure what is happening as it doesn't seem to be related to any snippet - currently, my configuration is the default configuration for TrueZen as of this moment. A simple config would be to just have TrueZen.nvim installed via Packer in your init.lua and that is it. To reproduce my issue, I would say have two tabs open and in each tab have open maybe two or three buffers. Then, from Tab 1 open up a focused buffer via :TZFocus and then close it when done using :TZFocus. Do the same with Tab 2. Then, if it works as I expected, after repeating this switching for a while you should at some point see a tab get automatically closed after calling:TZFocus` sometime leaving just one tab with the correctly configured buffer and another tab that is now just the single previously focused buffer.

The behavior is very inconsistent and I haven't been able to track down when exactly it happens yet nor what version of TrueZen it seems to be coming from. I am away from my computer that has Packer configured so I can't reproduce a video of the behavior at the moment.

loqusion commented 2 years ago

It could be that another part of your config, or perhaps another plugin, is interacting in such a way that it erroneously closes your original tab upon exiting focus mode, perhaps with an autocommand. If you could provide the rest of your config in a repository it could help me locate the issue.

Also, if you aren't using the latest version of true-zen then the issue could possibly lie there.

TheCedarPrince commented 2 years ago

Ooof - I won't have access to that computer for a couple weeks. Thanks for the help and I will post back the issue but it could very well be a version issue or plugin interference. Do you have any suggestions on how to back up a neovim config to GitHub by the way? Any nice tools available for it or is the best route just to go into your config environment at do git init and then manage it manually from there using git?

TheCedarPrince commented 2 years ago

Thanks for all the support by the way @loqusion ! :smile:

loqusion commented 2 years ago

Do you have any suggestions on how to back up a neovim config to GitHub by the way? Any nice tools available for it or is the best route just to go into your config environment at do git init and then manage it manually from there using git?

There are various ways to go about it, some people prefer a utility like chezmoi while I personally prefer using a bare git repo. There are lots of dotfiles repos on GitHub that you can take inspiration from. Whatever way you choose to go about it, it's important to have a backup of all your valuable dotfiles in case you lose them or you need to configure your development environment on a new system.

Thanks for all the support by the way @loqusion ! 😄

No problem! :P

BitInByte commented 10 months ago

Hello, first of all, thanks for the amazing plugin.

I'm experiencing a similar bug but in my case, when I use :TZFocus, it just opens a new tab, just fine but then, when I use :TZFocus again, instead of going directly to the tab where I issued the command :TZFocus previously, it just go to the same tab where the "fullscreen" tab were which ends up of being another tab that has nothing to do with it.

I can go easily back to the splits again where I issued the command :TZFocus for the first time with the :tabprev command, and it would go back to the splits tab it just feels strange.

Basically, this is what happens: tabs: [1, 2, 3, 4, 5] There's a split with 2 windows on tab 2. On one of them I Issue the command :TZFocus. It creates a new tab with the content of the window where I Issued the command. In this case, we will have the split on tab 2 and the "fullscreen" on tab 3. Then, on tab 3 with the "fullscreen", I issue the command again :TZFocus. Now, after issuing that command, the tab 3 get's closed but now, instead of redirecting to the tab 2 to go back to the split windows, it just stays on tab 3 which in this case is a tab that has nothing to do with the original content.