Skip to content

Commit

Permalink
neovim: Fix lazygit terminal detection
Browse files Browse the repository at this point in the history
  • Loading branch information
juanibiapina committed Dec 22, 2024
1 parent 3639701 commit 1e5d3b7
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions dotfiles/nvim/.config/nvim/conf/auto/lazygit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,10 @@ local nvim_terminal_augroup = vim.api.nvim_create_augroup('nvim_terminal', { cle
vim.api.nvim_create_autocmd({ 'TermClose' }, {
group = nvim_terminal_augroup,
desc = 'Automatically close buffers after running lazygit',
pattern = 'term://*:lazygit',
callback = function(args)
if vim.v.event.status == 0 then
-- TODO: Find a better way to detect lazygit, this also breaks when running :terminal
local info = vim.api.nvim_get_chan_info(vim.bo[args.buf].channel)
local argv = info.argv or {}
-- argv should be { ".../zsh", "-c", "lazygit" }
if #argv == 3 and argv[3] == 'lazygit' then
vim.cmd({ cmd = 'bdelete', args = { args.buf }, bang = true })
end
vim.cmd({ cmd = 'bdelete', args = { args.buf }, bang = true })
end
end,
})
Expand Down

0 comments on commit 1e5d3b7

Please sign in to comment.