git-messenger.vim icon indicating copy to clipboard operation
git-messenger.vim copied to clipboard

Autoclose on BufLeave should be only when entering into a normal buffer

Open wookayin opened this issue 3 years ago • 2 comments

There is a BufLeave autocmd that will make the git-messenger popup window closed when the focus has moved to another window. However, the event is also triggered when there appears another pop-up window, like wilder.nvim, LSP status, vim.ui.input plugins, etc.

For example, I use wilder.nvim which implements wildmenu as a pop-up window; when pressing '/' (search) the git-messenger window will be automatically closed as soon as the pop-up window appears. This prevents me from doing search on the git-messenger buffer.

One solution would be to not use BufLeave <buffer> autocmd, but instead use other events (such as WinEnter) to determine if the user entered a "normal", non-floating buffer/window. FYI, nvim-lsp-installer implements this idea to make auto-closing behavior in the presence of other floating windows much more reasonable.

wookayin avatar May 24 '22 03:05 wookayin

It sounds hard what "normal" exactly means here.

rhysd avatar Sep 20 '22 14:09 rhysd

I meant, by normal, a non-floating window (split windows). Sorry for the confusion. Do you have any other questions? If you have hard time getting my point, I can go out of my way to make some GIFs to show why the current behavior can be annoying and how it could be improved.

wookayin avatar Sep 20 '22 16:09 wookayin