From 1df8956e4bd8aee8259e192adef39b35b70c53dd Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Sat, 18 Jan 2025 21:21:17 -0800 Subject: [PATCH] feat: automatically resize windows when terminal window resized --- init.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/init.lua b/init.lua index 34549c0..57ba737 100644 --- a/init.lua +++ b/init.lua @@ -65,6 +65,7 @@ require("nvim-treesitter.configs").setup({ }, }) +-- no line numbers for terminals vim.api.nvim_create_autocmd({ "TermOpen", }, { @@ -74,6 +75,7 @@ vim.api.nvim_create_autocmd({ end, }) +-- flash yanked test vim.api.nvim_create_autocmd("TextYankPost", { callback = function() 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, { 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", +})