summaryrefslogtreecommitdiff
path: root/lua/autocommands/buffer.lua
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-06-02 21:06:44 +0200
committerHampusM <hampus@hampusmat.com>2024-06-02 21:06:44 +0200
commitbb21d2f482bc1bfd25b1de72846ce115114c6f27 (patch)
tree7cf9b199534a54a213bbb980023717f1159fa81e /lua/autocommands/buffer.lua
parent0d380e8916a7ddf89193a76bd711ae1661ae9b44 (diff)
prevent terminal from being resized
Diffstat (limited to 'lua/autocommands/buffer.lua')
-rw-r--r--lua/autocommands/buffer.lua25
1 files changed, 25 insertions, 0 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
+ }
+)
+