From 066b89fa07ea0ecf4c745b379763da0cff57bd2c Mon Sep 17 00:00:00 2001 From: psychhim Date: Sun, 5 Oct 2025 11:24:40 +0530 Subject: [PATCH] added empty horizontal and vertical split window keybinds --- init.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/init.lua b/init.lua index 4d4a372..0be820e 100644 --- a/init.lua +++ b/init.lua @@ -360,6 +360,20 @@ vim.keymap.set('n', 'e', function() vim.cmd 'enew' -- create a new empty buffer in it end, { noremap = true, silent = true }) +-- Horizontal split with new empty buffer below +vim.keymap.set('n', 'sv', function() + vim.cmd('split') -- create horizontal split (above by default) + vim.cmd('wincmd j') -- move to the new split below + vim.cmd('enew') -- open new empty buffer +end, { desc = "New buffer in horizontal split (below)" }) + +-- Vertical split with new empty buffer to the right +vim.keymap.set('n', 'sh', function() + vim.cmd('vsplit') -- create vertical split (left by default) + vim.cmd('wincmd l') -- move to the new split to the right + vim.cmd('enew') -- open new empty buffer +end, { desc = "New buffer in vertical split (right)" }) + -- Save current buffer (asks for filename if new/unsaved) vim.keymap.set('n', 'w', function() if vim.api.nvim_buf_get_name(0) == '' then