Skip to content

fix: closing lazygit when any neovim TermClose event fires #226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 21, 2025

Conversation

mikavilpas
Copy link
Owner

Issue:

After starting lazygit, if you start an unrelated terminal in Neovim and then close it, the lazygit is also closed. This is because the TermClose event is currently triggered for all terminal buffers, not just the one running lazygit.

I ran into this when using https://github.com/mikavilpas/yazi.nvim, but didn't notice it happens until now.

Solution:

Only close lazygit when the terminal buffer that lazygit is running in is closed.

**Issue:**

After starting lazygit, if you start an unrelated terminal in Neovim and
then close it, the lazygit is also closed. This is because the
`TermClose` event is currently triggered for all terminal buffers, not
just the one running lazygit.

I ran into this when using https://github.com/mikavilpas/yazi.nvim, but
didn't notice it happens until now.

**Solution:**

Only close lazygit when the terminal buffer that lazygit is running in
is closed.
@mikavilpas
Copy link
Owner Author

See #225 (comment) to understand why the build fails

@mikavilpas mikavilpas enabled auto-merge (rebase) June 21, 2025 17:33
@mikavilpas mikavilpas disabled auto-merge June 21, 2025 17:33
@mikavilpas mikavilpas merged commit 0f52e3f into main Jun 21, 2025
0 of 11 checks passed
@mikavilpas mikavilpas deleted the close-only-when-lazygit-is-closed branch June 21, 2025 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant