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
base: develop
from

Conversation

Projects
None yet
4 participants
@bmag
Collaborator

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 toavy-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

This comment has been minimized.

Show comment
Hide comment
@syl20bnr

syl20bnr Aug 7, 2015

Owner

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

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

This comment has been minimized.

Show comment
Hide comment
@bmag

bmag Aug 7, 2015

Collaborator

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

Collaborator

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

This comment has been minimized.

Show comment
Hide comment
@syl20bnr

syl20bnr Aug 7, 2015

Owner

Excellent 👍

Owner

syl20bnr commented Aug 7, 2015

Excellent 👍

@myrjola

This comment has been minimized.

Show comment
Hide comment
@myrjola

myrjola Aug 7, 2015

Contributor

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.

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

This comment has been minimized.

Show comment
Hide comment
@expez

expez 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.

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

This comment has been minimized.

Show comment
Hide comment
@bmag

bmag Aug 7, 2015

Collaborator

@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.

Collaborator

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

This comment has been minimized.

Show comment
Hide comment
@bmag

bmag Aug 7, 2015

Collaborator

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).

Collaborator

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

This comment has been minimized.

Show comment
Hide comment
@myrjola

myrjola Aug 8, 2015

Contributor

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

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

This comment has been minimized.

Show comment
Hide comment
@syl20bnr

syl20bnr Aug 11, 2015

Owner

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

Owner

syl20bnr commented Aug 11, 2015

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

@syl20bnr

This comment has been minimized.

Show comment
Hide comment
@syl20bnr

syl20bnr Aug 11, 2015

Owner

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

Owner

syl20bnr commented Aug 11, 2015

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

@syl20bnr syl20bnr closed this Aug 11, 2015

@bmag bmag deleted the bmag:avy branch Aug 13, 2015

@srid srid referenced this pull request Sep 3, 2015

Closed

fast goto line #1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment