From e324019a1ca379294c59383c084f47c254219e9b Mon Sep 17 00:00:00 2001 From: Ducky Date: Mon, 12 May 2025 21:57:51 +1000 Subject: [PATCH] Resize how large terminals open, new keymaps and keymap for exiting terminal mode --- lua/custom/plugins/toggleterm.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lua/custom/plugins/toggleterm.lua b/lua/custom/plugins/toggleterm.lua index 482c3a8..bac3bdc 100644 --- a/lua/custom/plugins/toggleterm.lua +++ b/lua/custom/plugins/toggleterm.lua @@ -13,15 +13,28 @@ return { winbar = { link = 'winbar' }, winbarnc = { link = 'winbarnc' }, }, - size = 10, on_create = function() vim.opt.foldcolumn = '0' vim.opt.signcolumn = 'no' end, + size = function(term) + if term.direction == 'horizontal' then + return 15 + elseif term.direction == 'vertical' then + return vim.o.columns * 0.4 + end + end, + shell = 'pwsh', open_mapping = [[]], shading_factor = 2, direction = 'float', float_opts = { border = 'rounded' }, + vim.keymap.set('n', 'tv', 'ToggleTerm direction=vertical', { desc = 'ToggleTerm vertical' }), + vim.keymap.set('n', 'tnv', 'TermNew direction=vertical', { desc = 'ToggleTerm New vertical' }), + vim.keymap.set('n', 'tt', 'ToggleTerm direction=horizontal', { desc = 'ToggleTerm horizontal' }), + vim.keymap.set('n', 'tnh', 'TermNew direction=horizontal', { desc = 'ToggleTerm New horizontal' }), + vim.keymap.set('n', 'tf', 'ToggleTerm direction=float', { desc = 'ToggleTerm float' }), + vim.api.nvim_set_keymap('t', '', '', { noremap = true }), }, }, }