nvim-tree.lua icon indicating copy to clipboard operation
nvim-tree.lua copied to clipboard

Reliably determine if nvim-tree is last window and exit gracefully

Open beauwilliams opened this issue 2 years ago • 5 comments

This is a PR aims to solve #1368 by parsing the window layout of the current window to reliably determine whether NvimTree if the last window and if so quits.

Also solving an apparent issue highlighted in snippet provided by readme this PR adds confirm quit so that we can also get a graceful exit in the case of unsaved buffers in the background.

I was sorely missing this feature when it was deprecated so I am hoping that this is good enough for it to be added back in :)

beauwilliams avatar Jul 26 '22 13:07 beauwilliams

To be honest, we removed this because there were too many people asking for different implementations of this feature. We spent a lot of time answering these issues. We don't want to maintain this, that's why we left it to the users. I believe a wiki page + a note in the readme would be good enough.

kyazdani42 avatar Jul 26 '22 14:07 kyazdani42

I totally understand, there were quite a few different ones flying around.

This solution should be quite a bit more robust in its approach compared to what was floating around, so at least the community can use it as they please

beauwilliams avatar Jul 26 '22 14:07 beauwilliams

what i mean is that we won't merge that again, because even if it works better for some people, some other people will want different implementations. You can write a new wiki page once you are done with the implementation :)

kyazdani42 avatar Jul 26 '22 14:07 kyazdani42

No problem :)

beauwilliams avatar Jul 27 '22 00:07 beauwilliams

Wiki / readme: yes

nvim-tree functionality: no

This is hugely problematic due to:

  • unpredictable vim event ordering, especially factoring in nested autocommands
  • vim plugins / automation modifying buffers and windows during BufEnter

alex-courtis avatar Jul 31 '22 03:07 alex-courtis