fixed lazygit

This commit is contained in:
Oliver Hartmann 2024-06-07 00:24:45 +02:00
parent ae5b5fd06b
commit 02182b7711

View File

@ -18,26 +18,28 @@ return {
})
local Terminal = require('toggleterm.terminal').Terminal
local lazygit = Terminal:new({
cmd = 'lazygit',
dir = vim.fn.getcwd(),
direction = 'float',
float_opts = {
border = 'double',
},
-- function to run on opening the terminal
on_open = function(term)
vim.cmd('startinsert!')
vim.api.nvim_buf_set_keymap(term.bufnr, 'n', 'q', '<cmd>close<CR>', { noremap = true, silent = true })
end,
-- function to run on closing the terminal
on_close = function(term)
vim.cmd('startinsert!')
end,
})
function _lazygit_toggle()
lazygit:toggle()
local lazygit = Terminal:new({
cmd = 'lazygit',
direction = 'float',
cwd = function()
return vim.fn.getcwd()
end,
float_opts = {
border = 'double',
},
-- function to run on opening the terminal
on_open = function(term)
vim.cmd('startinsert!')
vim.api.nvim_buf_set_keymap(term.bufnr, 'n', 'q', '<cmd>close<CR>', { noremap = true, silent = true })
end,
-- function to run on closing the terminal
on_close = function(term)
vim.cmd('startinsert!')
end,
})
lazygit:open()
end
end,
keys = {