nyngwang / NeoZoom.lua

A simple usecase of floating window to help you focus.
MIT License
184 stars 15 forks source link

Auto unfocus when navigating to other buffers #44

Closed jeeeem closed 1 year ago

jeeeem commented 1 year ago

Is there a way to do this?

EDIT: And maybe also when splitting planes 'cos i'm having this behavior

image

nyngwang commented 1 year ago

Yes, this is possible and I actually implemented this before and discarded it. I will create an option for this.

jeeeem commented 1 year ago

Yes, this is possible and I actually implemented this before and discarded it. I will create an option for this.

Please do, it will very efficient for us users to use it than manually pressing the toggle key. thanks

nyngwang commented 1 year ago

@jeeeem Hi, thanks for your waiting. Now it has been done and it's enabled by default so you don't have to do anything to get the change. Instead, you can disable it by:

setup {
  disable_by_cursor = false,
}

(btw I also found some parts of my code that need to be refactored during adding this feature. So many thanks for you creating this issue)

nyngwang commented 1 year ago

@jeeeem FYI: disable_by_cursor is removed in ab69e31(can remove this option in setup).

nyngwang commented 1 year ago

9f54eb9: there is no autocmd anymore so, unfortunately, now you have to call NeoZoomToggle again when you feel lost so the cursor will jump back to the zoom-in window. After that, you just call NeoZoomToggle again so it will be closed. (This design is to support nvim-dap-ui by avoiding problematic autocmds introduced by my solution to this issue.)

jeeeem commented 1 year ago

Thanks for updating me although you don't have to do that. And I'm okay with the changes, I see myself toggling the zoom than auto zooming in/out so I don't have a problem with the change.