change terminal size
This commit is contained in:
@@ -2,7 +2,13 @@ local config = {
|
|||||||
active = true,
|
active = true,
|
||||||
on_config_done = nil,
|
on_config_done = nil,
|
||||||
-- size can be a number or function which is passed the current terminal
|
-- 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 = [[<c-t>]],
|
open_mapping = [[<c-t>]],
|
||||||
hide_numbers = true, -- hide the number column in toggleterm buffers
|
hide_numbers = true, -- hide the number column in toggleterm buffers
|
||||||
shade_filetypes = {},
|
shade_filetypes = {},
|
||||||
@@ -62,7 +68,7 @@ end
|
|||||||
---@return integer
|
---@return integer
|
||||||
local function get_dynamic_terminal_size(direction, size)
|
local function get_dynamic_terminal_size(direction, size)
|
||||||
size = size or config.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)
|
size = math.min(size, 1.0)
|
||||||
local buf_sizes = get_buf_size()
|
local buf_sizes = get_buf_size()
|
||||||
local buf_size = direction == "horizontal" and buf_sizes.height or buf_sizes.width
|
local buf_size = direction == "horizontal" and buf_sizes.height or buf_sizes.width
|
||||||
|
|||||||
Reference in New Issue
Block a user