use toggleterm for lazygit
This commit is contained in:
parent
b8e9373c79
commit
3fe8d4f86d
@ -1,19 +0,0 @@
|
|||||||
return {
|
|
||||||
'kdheepak/lazygit.nvim',
|
|
||||||
cmd = {
|
|
||||||
'LazyGit',
|
|
||||||
'LazyGitConfig',
|
|
||||||
'LazyGitFilter',
|
|
||||||
'LazyGitFilterCurrentFile',
|
|
||||||
'LazyGit',
|
|
||||||
},
|
|
||||||
keys = {
|
|
||||||
{
|
|
||||||
'<Space>g',
|
|
||||||
function()
|
|
||||||
require('lazygit').lazygit()
|
|
||||||
end,
|
|
||||||
desc = 'LazyGit'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -18,7 +18,40 @@ return {
|
|||||||
})
|
})
|
||||||
|
|
||||||
local Terminal = require('toggleterm.terminal').Terminal
|
local Terminal = require('toggleterm.terminal').Terminal
|
||||||
|
local lazygit = Terminal:new({
|
||||||
|
cmd = 'lazygit',
|
||||||
|
dir = 'git_dir',
|
||||||
|
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,
|
end,
|
||||||
|
-- function to run on closing the terminal
|
||||||
|
on_close = function(term)
|
||||||
|
vim.cmd('startinsert!')
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
function _lazygit_toggle()
|
||||||
|
lazygit:toggle()
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>g', function()
|
||||||
|
end,
|
||||||
|
{ noremap = true, silent = true })
|
||||||
|
end,
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
'<Space>g',
|
||||||
|
function()
|
||||||
|
_lazygit_toggle()
|
||||||
|
end,
|
||||||
|
desc = 'LazyGit'
|
||||||
|
}
|
||||||
|
},
|
||||||
cmd = 'ToggleTerm',
|
cmd = 'ToggleTerm',
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user