From bb21d2f482bc1bfd25b1de72846ce115114c6f27 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 2 Jun 2024 21:06:44 +0200 Subject: prevent terminal from being resized --- lua/autocommands/buffer.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'lua/autocommands') 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 + } +) + -- cgit v1.2.3-18-g5258