From f92a108579a32ade5208bfb65d60259eb3df4df9 Mon Sep 17 00:00:00 2001 From: Dominik Polakovics Date: Thu, 16 Nov 2023 15:31:53 +0100 Subject: [PATCH] change terminal size --- .../nb-01.cloonar.com/modules/nvim/config/terminal.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hosts/nb-01.cloonar.com/modules/nvim/config/terminal.lua b/hosts/nb-01.cloonar.com/modules/nvim/config/terminal.lua index 064fd3b..979dc28 100644 --- a/hosts/nb-01.cloonar.com/modules/nvim/config/terminal.lua +++ b/hosts/nb-01.cloonar.com/modules/nvim/config/terminal.lua @@ -2,7 +2,13 @@ local config = { active = true, on_config_done = nil, -- size can be a number or function which is passed the current terminal - size = 20, + size = 20 | function(term) + if term.direction == "horizontal" then + return 15 + elseif term.direction == "vertical" then + return vim.o.columns * 0.4 + end + end, open_mapping = [[]], hide_numbers = true, -- hide the number column in toggleterm buffers shade_filetypes = {}, @@ -62,7 +68,7 @@ end ---@return integer local function get_dynamic_terminal_size(direction, size) size = size or config.size - if direction ~= "float" and tostring(size):find(".", 1, true) then + if direction ~= "vertical" and tostring(size):find(".", 1, true) then size = math.min(size, 1.0) local buf_sizes = get_buf_size() local buf_size = direction == "horizontal" and buf_sizes.height or buf_sizes.width