return { 'akinsho/toggleterm.nvim', version = '*', keys = { { '', desc = 'Toggle terminal' }, { 'tf', desc = 'Toggle floating terminal' }, { 'th', desc = 'Toggle horizontal terminal' }, }, opts = { size = function(term) if term.direction == 'horizontal' then return 15 elseif term.direction == 'vertical' then return vim.o.columns * 0.4 end end, open_mapping = [[]], direction = 'float', float_opts = { border = 'curved', }, shade_terminals = true, }, config = function(_, opts) require('toggleterm').setup(opts) local Terminal = require('toggleterm.terminal').Terminal -- Floating terminal shortcut local float_term = Terminal:new { direction = 'float' } vim.keymap.set('n', 'tf', function() float_term:toggle() end, { desc = '[T]oggle [F]loating terminal' }) -- Horizontal terminal shortcut local h_term = Terminal:new { direction = 'horizontal' } vim.keymap.set('n', 'th', function() h_term:toggle() end, { desc = '[T]oggle [H]orizontal terminal' }) end, }