local M = { 'numToStr/FTerm.nvim', keys = { { 'gg', 'Lazygit', desc = 'Lazygit' }, { 'gh', 'GitHistory', desc = 'Git history' }, { 'gB', 'GitBlame', desc = 'Git Blame' }, }, lazy = true, } function M.config() local fterm = require('FTerm') local lazygit = fterm:new({ -- ft = 'fterm_lazygit', -- You can also override the default filetype, if you want cmd = 'lazygit', dimensions = { height = 0.9, width = 0.9, }, }) local git_history = function() local file = vim.api.nvim_buf_get_name(0) local cmd = 'git log -p --ext-diff ' .. file fterm.scratch({ -- ft = 'git_history', -- You can also override the default filetype, if you want cmd = cmd, dimensions = { height = 0.9, width = 0.9, }, }) end local git_blame = function() local file = vim.api.nvim_buf_get_name(0) local cmd = 'git blame ' .. file fterm.scratch({ -- ft = 'git_history', -- You can also override the default filetype, if you want cmd = cmd, dimensions = { height = 0.9, width = 0.9, }, }) end vim.keymap.set('n', 'Lazygit', function() lazygit:toggle() end, { desc = 'Toggle lazygit' }) vim.keymap.set('n', 'GitHistory', git_history, { desc = 'Show git history' }) vim.keymap.set('n', 'GitBlame', git_blame, { desc = 'Show git blame' }) end return M