akinsho / akinsho/toggleterm.nvim

How to create a dynamically sized terminal

Abierto
#658 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Lua
Estrellas
5.6k
Forks
206
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.