feat: automatically resize windows when terminal window resized

This commit is contained in:
Youwen Wu 2025-01-18 21:21:17 -08:00
parent b720dd5b85
commit 1df8956e4b
Signed by: youwen5
GPG key ID: 865658ED1FE61EC3

View file

@ -65,6 +65,7 @@ require("nvim-treesitter.configs").setup({
}, },
}) })
-- no line numbers for terminals
vim.api.nvim_create_autocmd({ vim.api.nvim_create_autocmd({
"TermOpen", "TermOpen",
}, { }, {
@ -74,6 +75,7 @@ vim.api.nvim_create_autocmd({
end, end,
}) })
-- flash yanked test
vim.api.nvim_create_autocmd("TextYankPost", { vim.api.nvim_create_autocmd("TextYankPost", {
callback = function() callback = function()
vim.highlight.on_yank({ higroup = "Visual", timeout = 300 }) vim.highlight.on_yank({ higroup = "Visual", timeout = 300 })
@ -84,3 +86,13 @@ vim.api.nvim_create_autocmd("TextYankPost", {
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
silent = true, silent = true,
}) })
vim.api.nvim_create_autocmd({ "VimResized" }, {
group = vim.api.nvim_create_augroup("EqualizeSplits", {}),
callback = function()
local current_tab = vim.api.nvim_get_current_tabpage()
vim.cmd("tabdo wincmd =")
vim.api.nvim_set_current_tabpage(current_tab)
end,
desc = "Resize splits with terminal window",
})