DanilaMihailov/beacon.nvim

Repeat search with n/N doesn't trigger beacon highlight sometimes

zealotrush opened this issue · 3 comments

After pressing n/N, if the window scrolls, and the new cursor location is within 10 lines (default value of g:beacon_minimal_jump) of the original location, the cursor won't be highlighted, even though the cursor actually jumped crossed more than 10 lines.

I recorded a asciinema for demonstrating this issue.

https://asciinema.org/a/ohhbJwqTgdn1CA4MhGKMADrbQ

Update

I just realized that the highlighting is based on the cursor location on screen, not its absolute line numbers in files. For example, if I scroll the screen by pressing Ctrl-E/Y more than 10 lines, the next time I press j/k, the cursor would be highlighted. I find this behavior somewhat confusing.

Anyway, this plugin is still quite helpful and eye pleasing. I love it! Thank you!

About n/N jumps, it is done like this by design, but you still can get highlights. Try this

nmap n n:Beacon<cr>
nmap N N:Beacon<cr>
nmap * *:Beacon<cr>
nmap # #:Beacon<cr>

There is :Beacon command, thats highlights current position, this maps just call this command every time you press n/N.

I just realized that the highlighting is based on the cursor location on screen, not its absolute line numbers in files

It used to be absolute lines, but it is hard to ignore folds with absolute lines and if after jump cursor stays on the same line relative to window, it means you already know where it is. But I am open to suggestions :)

if I scroll the screen by pressing Ctrl-E/Y more than 10 lines, the next time I press j/k, the cursor would be highlighted

That looks like a bug, will look into it. Thank you for feedback :)

The mapping works good enough for me. In fact, the :Beacon command is all I need. I'll try to build my own specific way of using it. Thanks!

Cool! I updated readme with this mappings, so everyone else can see them. I'am still looking for ways to better expose plugin apis, so if you have ideas you can leave them here or create new issue :)

I keep this issue open, until I fix bug with <Ctrl-E/Y>.