feat(keys): add ctrl+hjkl in insert and command-line mode and H/L to move to line start/end

This commit is contained in:
sankalp committed 2025-10-03 18:22:45 +05:45
1 parent 75180b528b
commit a696686cf7
1 file changed
+8 -4
+8 -4
View File
@@ -81,10 +81,10 @@ map('v', "<leader>'", "s''<esc>Pll", { desc = 'wrap selection with single quotes
map('v', '<leader>"', 's""<esc>Pll', { desc = 'wrap selection with double quotes' })
-- Insert mode cursor movement with Ctrl+hjkl
map('i', '<C-h>', '<Left>', { noremap = true, silent = true })
map('i', '<C-j>', '<Down>', { noremap = true, silent = true })
map('i', '<C-k>', '<Up>', { noremap = true, silent = true })
map('i', '<C-l>', '<Right>', { noremap = true, silent = true })
map({ 'i', 'c' }, '<C-h>', '<Left>', { noremap = true, silent = true })
map({ 'i', 'c' }, '<C-j>', '<Down>', { noremap = true, silent = true })
map({ 'i', 'c' }, '<C-k>', '<Up>', { noremap = true, silent = true })
map({ 'i', 'c' }, '<C-l>', '<Right>', { noremap = true, silent = true })
map('n', '<leader>re', ':%s/<C-R><C-W>/', { 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/', '<esc>/\\%V', { silent = false, desc = 'Search inside visual selection' })