akinsho / akinsho/toggleterm.nvim

How to create a dynamically sized terminal

Aperta
#658 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Lua
Stelle
5.6k
Fork
206
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.