jesseduffield / jesseduffield/lazygit

awesomewm terminal

Open
#3,748 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
82.4k
Forks
3k
Avg merge
2d 18h
Merged PRs (30d)
19

Description

I'd love to implement this:

```lua
local Terminal = require'toggleterm.terminal'.Terminal

local function close_terminal_on_zero_exit(terminal, _, exit_code)
if exit_code == 0 then
terminal:close()
end
end

local lazygit = Terminal:new({
cmd = 'lazygit',
direction = 'float',
hidden = true,
on_exit = close_terminal_on_zero_exit,
})

local dotfileslazygit = Terminal:new({
cmd = 'lazygit --git-dir=$HOME/.cfg --work-tree=$HOME',
direction = 'float',
hidden = true,
on_exit = close_terminal_on_zero_exit,
})

wk.register({
G = { function()
if vim.loop.cwd() == vim.call('expand', '~/.config') then
dotfileslazygit:toggle()
else
lazygit:toggle()
end
end , 'lazygit'},
}, { prefix = 'g' })
```

_Originally posted by @bennypowers in https://github.com/jesseduffield/lazygit/discussions/1201#discussioncomment-2546527_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.