abo-abo / avy

Jump to things in Emacs tree-style
1.72k stars 110 forks source link

[Question] Is there an option to navigate like this? #242

Closed karambaq closed 6 years ago

karambaq commented 6 years ago

Hello, I'm ex-vimmer, in vim I used easymotion to jumping, and here the example what I mean:

Emacs avy:

2018-08-05 0 09 32

Vim-easymotion:

2018-08-05 0 09 55

As you can see, in vim closest jumps to current position usually a one symbol reference, with avy it almost always to two symbols

abo-abo commented 6 years ago

Avy sorts paths in order that they appear in the buffer. This is both simple and consistent.

But I see how your suggestion could be a useful improvement. I even think it was suggested somewhere before.

It should not be too difficult to implement: just sort the lst argument to avy-tree in order of closeness to the point position. Maybe someone could make a PR? Otherwise, I'll implement this myself later.

karambaq commented 6 years ago

It'll be great. Unfortunately I'm not in good relationships with lisp, I'll try to find someone in r/emacs.

abo-abo commented 6 years ago

Thanks, please test.

karambaq commented 6 years ago

@abo-abo Perfect, thanks so much!

lshoravi commented 6 years ago

@abo-abo Is it possible to get this behavior for avy-goto-word as well? :)

abo-abo commented 6 years ago

@lshoravi You can customize it like this:

(add-to-list 'avy-orders-alist '(avy-goto-word-1 . avy-order-closest))
lshoravi commented 6 years ago

Fantastic! Thank you :+1: