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 } })