justinmk / vim-sneak

The missing motion for Vim :athletic_shoe:
http://www.vim.org/scripts/script.php?script_id=4809
MIT License
3.24k stars 88 forks source link

[Bug Report] No label when too many occurrences of the search chars #280

Closed laggardkernel closed 3 years ago

laggardkernel commented 3 years ago

When the searched characters occur too many times, there's not enough label. Some of the occurrences are highlighted but without any label set.

bruhtus commented 3 years ago

You can add more label by using g:sneak#target_labels. Here's an example:

let g:sneak#target_labels = ';aszxcfvqwertyuiopbnmABCEFGIJKNOPQRSTUVZ'

For more info :help sneak-options

laggardkernel commented 3 years ago

Thanks, I got it. Only one character label is supported, I need to add more characters as label candidate.

ggandor commented 3 years ago

@laggardkernel If there are more matches than labels, you can switch to the next set of matches with tab (:h sneak-mappings -> label mode).

glyh commented 3 years ago

I think it would be better if there are multi char label supported, we can take vim-smalls's behavior as reference:

  1. For multiple chars, The last label appear repeatedly.
  2. On typing that label, all label refreshes just for matches marked as that label.
  3. Repeat 1~2 until we got a single match.
justinmk commented 3 years ago

I think it would be better if there are multi char label supported, we can take vim-smalls's behavior as reference:

Intentionally not supported. That is clumsy, might as well use / at that point.

ggandor commented 3 years ago

@justinmk Theoretically Sneak could do the same as Lightspeed, processing two match groups at a time, and showing them with a different background color, indicating that all the matches in the second group are prefixed with tab. This adds ~zero mental load as opposed to two-char labels. But I think this cannot be implemented at the moment if relying on Conceal, right? (related) Don't you happen to have some idea to work around that? I'd be happy to do a PR if we could figure out something.

justinmk commented 3 years ago

But I think this cannot be implemented at the moment if relying on Conceal, right? (related) Don't you happen to have some idea to work around that?

Not possible afaik. But I also don't see why a different color would be any help. The unlabeled matches are pretty recognizable.

ggandor commented 3 years ago

We would use the same set of labels twice, highlighted differently, so you could see the distant labels too right away, and at least for the second group, the additional short pause would be eliminated.