From a696686cf711e8517de82d9163c5f350770810ac Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Fri, 3 Oct 2025 18:22:45 +0545 Subject: [PATCH] feat(keys): add ctrl+hjkl in insert and command-line mode and H/L to move to line start/end --- lua/core/keys.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lua/core/keys.lua b/lua/core/keys.lua index 2dc0005..7160f95 100644 --- a/lua/core/keys.lua +++ b/lua/core/keys.lua @@ -81,10 +81,10 @@ map('v', "'", "s''Pll", { desc = 'wrap selection with single quotes map('v', '"', 's""Pll', { desc = 'wrap selection with double quotes' }) -- Insert mode cursor movement with Ctrl+hjkl -map('i', '', '', { noremap = true, silent = true }) -map('i', '', '', { noremap = true, silent = true }) -map('i', '', '', { noremap = true, silent = true }) -map('i', '', '', { noremap = true, silent = true }) +map({ 'i', 'c' }, '', '', { noremap = true, silent = true }) +map({ 'i', 'c' }, '', '', { noremap = true, silent = true }) +map({ 'i', 'c' }, '', '', { noremap = true, silent = true }) +map({ 'i', 'c' }, '', '', { noremap = true, silent = true }) map('n', 're', ':%s//', { desc = 'Shortcut to replace current word under cursor' }) @@ -103,5 +103,9 @@ for _, mode in ipairs(modes) do end end +-- Go to Beginning or End of line +map({ 'n', 'v' }, 'H', '_^', { desc = 'Move to the beginning of the line' }) +map({ 'n', 'v' }, 'L', '$', { desc = 'Move to the end of the line' }) + -- Search inside visually highlighted text. map('x', 'g/', '/\\%V', { silent = false, desc = 'Search inside visual selection' })