feat(nvim): toggle lazygit when hitting q

This commit is contained in:
Sergio Laín 2025-02-02 00:41:26 +01:00
parent 212789c05e
commit 1b3ed7466e
No known key found for this signature in database
GPG key ID: 51BB28D8B42FB438

View file

@ -113,3 +113,15 @@ ac("BufWritePre", {
vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p")
end,
})
-- Toggle lazygit instead of closing
vim.api.nvim_create_autocmd("TermOpen", {
pattern = "*",
callback = function()
local term_title = vim.b.term_title
if term_title and term_title:match("lazygit") then
-- Create lazygit specific mappings
vim.keymap.set("t", "q", "<cmd>close<cr>", { buffer = true })
end
end,
})