change terminal size
This commit is contained in:
parent
d54ced97ae
commit
f92a108579
1 changed files with 8 additions and 2 deletions
|
|
@ -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 = [[<c-t>]],
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue