rhysd / git-messenger.vim

Vim and Neovim plugin to reveal the commit messages under the cursor
MIT License
1.34k stars 32 forks source link

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

Open wookayin opened 2 years ago

wookayin commented 2 years ago

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.

rhysd commented 2 years ago

It sounds hard what "normal" exactly means here.

wookayin commented 2 years ago

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.