summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lua/autocommands/buffer.lua25
-rw-r--r--lua/functions.lua2
2 files changed, 26 insertions, 1 deletions
diff --git a/lua/autocommands/buffer.lua b/lua/autocommands/buffer.lua
index da330c8..c1115ba 100644
--- a/lua/autocommands/buffer.lua
+++ b/lua/autocommands/buffer.lua
@@ -1,4 +1,29 @@
require("utility.autocmd")
+local function list_contains(haystack, needle)
+ for _, item in ipairs(haystack) do
+ if item == needle then
+ return true
+ end
+ end
+
+ return false
+end
+
-- autocmd("BufEnter", "*", "lua remove_hidden_windowless_buffers()")
+vim.api.nvim_create_autocmd(
+ "WinResized",
+ {
+ pattern = "*",
+ callback = function ()
+ if not list_contains(vim.v.event.windows, vim.g.term_win) then
+ -- Terminal have not been resized
+ return
+ end
+
+ set_terminal_height(vim.g.terminal_height)
+ end
+ }
+)
+
diff --git a/lua/functions.lua b/lua/functions.lua
index 07f8868..ab903b1 100644
--- a/lua/functions.lua
+++ b/lua/functions.lua
@@ -12,7 +12,7 @@ function table.filter(list, predicate)
return filtered_list
end
-local function set_terminal_height(height)
+function set_terminal_height(height)
if not vim.api.nvim_win_is_valid(vim.g.term_win) then
return
end