fixed lazygit
This commit is contained in:
parent
ae5b5fd06b
commit
02182b7711
@ -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 = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user