Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace ace-jump with avy #2574

Closed
wants to merge 1 commit into from
Closed

Replace ace-jump with avy #2574

wants to merge 1 commit into from

Conversation

bmag
Copy link
Contributor

@bmag bmag commented Aug 7, 2015

Related issue: #1354 @TheBB suggested to do a PR to get things in motion.
I've made the necessary changes to replace ace-jump with avy. Below is a summary.

SPC SPC is bound to avy-goto-word-or-subword-1 (was evil-ace-jump-word-mode)
SPC l is bound to avy-goto-line (was evil-ace-jump-line-mode)
SPC </kbd> is bound to avy-pop-mark(wasace-jump-mode-pop-mark`)

I set avy-keys to use the same keys as ace-jump (a-z) when selecting candidates. It might be
better UI to use avy's default keys (asdfghjkl).

I set avy to allow jumping to other windows and frames, as mentioned in #1534 (comment)

I didn't add avy faces to any themes, despite it being suggested in #1534 (comment).

avy-pop-mark is actually pop-to-mark-command in disguise, and it doesn't work as well as
ace-jump-mode-pop-mark - it doesn't jump back across windows. I'll report an issue upstream and hopefully it will be improved. (EDIT: issue opened at abo-abo/avy#88)

I decided not to trigger golden-ratio after jumping, because I found it annoying. If there is
interest in it, the relevant commands can be added to golden-ratio-extra-commands.

I haven't touched the docs yet.

@syl20bnr
Copy link
Owner

syl20bnr commented Aug 7, 2015

Nice ! The reason why I delay the usage of avy is the evil integration.
Is d SPC l working with these modifications ?

@bmag
Copy link
Contributor Author

bmag commented Aug 7, 2015

Yes, seems to work (for me, at least). It deletes the region between the original point to the beginning of the selected line.

@syl20bnr
Copy link
Owner

syl20bnr commented Aug 7, 2015

Excellent 👍

@myrjola
Copy link
Contributor

myrjola commented Aug 7, 2015

Excellent work 👍!

This wasn't possible with ace-jump either, but maybe someone knows a fix.

I would like to select a range of lines in evil-visual-line-state. It's a mark command which selects whole lines between mark and point. It would be awesome to get avy-goto-line to work in evil-visual-line-state.

To reproduce:

  1. M-x evil-visual-line or V to enter evil-visual-line-state
  2. M-x avy-goto-line and choose another line. Notice that the point doesn't move to that line

I can also reproduce with the other avy-commands and a host of other non-evil commands as well. Where should we fix this? I don't quite understand the evil-visual-state code, but it's very strange that the normal visual state and even visual block state works with avy, but not the visual line state.

@expez
Copy link

expez commented Aug 7, 2015

This wasn't possible with ace-jump either

This works fine using ace-jump. I don't think I have any special compat code other than what evil itself ships with.

I do V and C-SPC (which I've bound to evil-ace-jump-line-mode). If I try to call evil-ace-jump-line-mode using M-x it doesn't work.

@bmag
Copy link
Contributor Author

bmag commented Aug 7, 2015

@myrjola this code seems to let you do with avy what @expez describes with ace-jump. I copied it from the definition of evil-ace-jump-line-mode and I have no idea why it works or how it works.

(evil-define-motion evil-avy-goto-line (count)
  "Jump visually to the beginning of a line using avy."
  :type line
  :repeat abort
  (evil-without-repeat
    (call-interactively 'avy-goto-line)))
(define-key evil-visual-state-map (kbd "C-SPC") 'evil-avy-goto-line)

I guess fully integrating evil and avy requires some work, but my evil-fu isn't strong enough for it.

@bmag
Copy link
Contributor Author

bmag commented Aug 7, 2015

I submitted a PR for evil that integrates evil and avy (see here). As a bonus, C-o will also recognize avy-powered jumps.
If anyone is interested, there's a brief evil manual available from evil's website at bitbucket (or here).

@myrjola
Copy link
Contributor

myrjola commented Aug 8, 2015

@bmag Many thanks! Your integration code works perfectly! Hopefully your PR will be accepted. Looking forward for this PR to be merged as well.

@syl20bnr
Copy link
Owner

Seems to be merged upstream, nice work @bmag 👍 I'm going to merge this PR soon.

@syl20bnr
Copy link
Owner

Thank you 👍 👍 👍
Cherry-picked into develop branch, you can safely delete your branch.

@syl20bnr syl20bnr closed this Aug 11, 2015
@bmag bmag deleted the avy branch August 13, 2015 05:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants