vim-easymotion
vim-easymotion copied to clipboard
Use faster highlighting when available
Using matchaddpos on each position individually has a lot of overhead, which causes vim to lag while it's highlighting too many targets. I've written two alternatives:
- The first one builds a list of targets, then sends them to matchaddpos in batches of 8, which is the current limit.
- The second one uses neovim api, which seems to be even more efficient.
I've compared the three methods on my machine using vim's profiler.
On a file with ~4k targets (61 lines, each containing 65 "aaa "s), the old method finishes highlights the targets in 4.3s, the batch method in 1.45s, and the neovim api in 1.05s.