aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/keymap.lua
diff options
context:
space:
mode:
authorVolodymyr Chernetskyi <19735328+chernetskyi@users.noreply.github.com>2026-09-15 14:53:40 +0200
committerLewis Russell <me@lewisr.dev>2026-09-16 15:23:54 +0100
commitff039bb024ca0a8753c6591fa8cb98312090f739 (patch)
tree9c3e8eb818d49c4559e607b27056b57fa049d821 /runtime/lua/vim/keymap.lua
parentcb766905464dd4407465a6b880f52e156e7a01c0 (diff)
downloadrneovim-ff039bb024ca0a8753c6591fa8cb98312090f739.tar.gz
rneovim-ff039bb024ca0a8753c6591fa8cb98312090f739.tar.bz2
rneovim-ff039bb024ca0a8753c6591fa8cb98312090f739.zip
perf(hightlight): compute only bounds for non-blockwise highlights
Problem: vim.hl.range() computes a segment for every selected line, then discards all but the outer endpoints for characterwise and linewise highlights. This makes highlighting large yanks and puts unnecessarily expensive. Solution: Use getregionpos() with bounds=true for these highlights. Also use bounds in the keymap example that only needs the first and last selected lines. AI-assisted
Diffstat (limited to 'runtime/lua/vim/keymap.lua')
-rw-r--r--runtime/lua/vim/keymap.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/runtime/lua/vim/keymap.lua b/runtime/lua/vim/keymap.lua
index 7451f42ad4..061d3340fe 100644
--- a/runtime/lua/vim/keymap.lua
+++ b/runtime/lua/vim/keymap.lua
@@ -39,9 +39,10 @@ local keymap = {}
--- type = 'v',
--- exclusive = false,
--- eol = false,
+--- bounds = true,
--- })
--- local line1 = region[1][1][2]
---- local line2 = region[#region][1][2]
+--- local line2 = region[1][2][2]
--- vim.print({ line1, line2 })
--- end)
---