feat(lua): introduce context‑aware paste mappings with auto‑indent

- New Features: Added `p` and `P` mappings that auto‑indent pasted text (`p=`] and `P=`]).
- Enhancements: Updated visual paste mapping to use `"_dP` for overwriting without affecting registers.
- Bug Fixes: Fixed potential register corruption by using `"_dP` on selection.
This commit is contained in:
sankalp committed 2026-05-18 21:58:52 +05:45
1 parent 76bc9f7742
commit 2b0cd45de9
1 file changed
+4
+4
View File
@@ -42,6 +42,10 @@ map({ 'n', 'v' }, 'L', '$', { desc = 'Move to the end of the line' })
-- Visual overwrite paste -- Visual overwrite paste
map({ 'v', 'x' }, 'p', '"_dP', opts) map({ 'v', 'x' }, 'p', '"_dP', opts)
-- Paste and auto-indent (context-aware)
map('n', 'p', 'p=`]', { desc = 'Paste and auto-indent' })
map('n', 'P', 'P=`]', { desc = 'Paste before and auto-indent' })
-- Do not copy on x -- Do not copy on x
map({ 'v', 'x' }, 'x', '"_x', opts) map({ 'v', 'x' }, 'x', '"_x', opts)
map('n', 'X', '"_D', opts) map('n', 'X', '"_D', opts)