From a6e8e6a7025ed74e7deb429aea48fb6edc6f3397 Mon Sep 17 00:00:00 2001 From: Jeremy Kaplan Date: Sun, 19 Oct 2025 16:02:37 -0400 Subject: [PATCH] neovim: Only auto-decide splits for tag jumps --- neovim/init.lua | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/neovim/init.lua b/neovim/init.lua index 4ba1910..27bcc06 100644 --- a/neovim/init.lua +++ b/neovim/init.lua @@ -88,7 +88,13 @@ vim.keymap.set("", ';0', ":close") vim.keymap.set("", 'w', ":w") -vim.keymap.set("n", "]", ":rightbelow wincmd ]") +vim.keymap.set("n", "]", function() + if vim.api.nvim_win_get_width(0) > 2 * 80 then + vim.cmd('vertical wincmd ]') + else + vim.cmd('horizontal wincmd ]') + end +end) -- TODO: Delete these ; fake-leader bindings vim.keymap.set("", ';w', ":w") @@ -136,17 +142,4 @@ vim.keymap.set("n", "", function() vim.cmd.redraw() end) --- Split windows vertically if there's enough width for two "full size" panes. --- Otherwise, split horizontally. -vim.api.nvim_create_autocmd('WinNew', { - callback = function() - if vim.fn.win_gettype(0) ~= '' then - return - end - if vim.api.nvim_win_get_width(0) > 2 * 80 then - vim.cmd.wincmd(vim.o.splitright and 'L' or 'H') - end - end -}) - vim.diagnostic.config({ jump = { float = true } })