akinsho / akinsho/toggleterm.nvim

How to create a dynamically sized terminal

Offen
#658 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Lua
Sterne
5.6k
Forks
206
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.