akinsho / akinsho/toggleterm.nvim

How to create a dynamically sized terminal

Đang mở
#658 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Lua
Star
5.6k
Fork
206
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I have the following function for my size value:

```lua
size = function(term)
if term.direction == "horizontal" then
return math.floor(vim.o.lines * 0.4)
elseif term.direction == "vertical" then
return math.floor(vim.o.columns * 0.4)
end
end,
```

This correctly determines 40% of the window size either horizontal or vertical, and the resulting terminal is spawned with the expected size. Toggling this terminal does not detect any size changes, but I think that is to be expected unless I change the settings for the toggling functionality to re-detect and resize accordingly.

However, when this terminal is killed completely rather than simply hidden (toggled off), I expect the next terminal to be sized according to the *current* size of the window. Unfortunately, every new terminal is spawned with the old value instead, resulting in terminals that are less than 40% wide or tall with respect to the current window. This issue also applies to floating terminals, making all types of terminals practically unusable without manually resizing them after changing the size of my editor window.

I run into this frequently because I still use tmux for a variety of reasons that neovim terminals in my current editor don't make sense for, such as a second nvim instance for testing config changes. Is there some way to automatically resize toggled terminals according to the current window size already? I couldn't find any mention of it in the readme, wiki or issues, but it's easy to overlook.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.