summaryrefslogtreecommitdiff
path: root/lua/autocommands/buffer.lua
blob: c1115ba54e6fe431966f6380e21988e9f5704c55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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
	}
)