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:
1 file changed
+4
@@ -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)
|
||||||
|
|||||||
Reference in new issue
Block a user