abo-abo / avy

Jump to things in Emacs tree-style
1.71k stars 109 forks source link

Jump by color #298

Open jtrakk opened 4 years ago

jtrakk commented 4 years ago

I like to use avy. The strategies it uses to tag words are

  1. Move the word over and insert a tag to the left of it. This means that the word isn't in the same place it was before I turned on avy, which is a small inconvenience.
  2. Overlay the tag on top of the first letters. This means I can't read the letters in the word I'm looking for, which is also a small inconvenience.

I had an idea for a third strategy that might address these minor inconveniences. I'll describe it here, I'd be interested in your thoughts.

First, define a set of seven or so memorable colors. Assign each of letter a color. For example, red-r, blue-b, green-g, ...

When avy-jump-to-word-by-color is invoked, count the number of words on the page. Calculate the number of decisions (decisions) needed to identify a word, log(number_of_words_on_page, base=number_of_memorable_colors).

Color the background of the first decisions letters of each word without hiding the letter itself. To navigate to the word whose first three letters are colored red, green, blue, the user types rgb. For words that are too short to fit all the branches, switch the color of the first letter after each decision.

Does that make sense? What do you think about the idea?

abo-abo commented 4 years ago

Interesting. It's possible to implement it by adapting avy--overlay-at-full. But I'm not sure how useful it would be. So it's a low priority for me to implement. But PRs welcome.