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

[Feature request] Go to the end of a candidate instead of the beginning #316

Closed
irigone opened this issue Dec 5, 2020 · 6 comments
Closed

Comments

@irigone
Copy link

irigone commented Dec 5, 2020

I want to go to the end of the candidate instead of its beginning. In my opinion, it's more intuitive, and most of people are already used to that, because they already used isearch. There should be a variable that changes that behaviour.
I find myself C-f'ing several times after using avy just because of that. For example, if I want to change align to align* in LaTeX, I'd instinctively use avy-goto-char-timer and type "align", then go to that candidate with the tree, because I want to append an asterisk. Now, after I do that, I'll have to type M-f to go to the end of the word. In this example, it's more intuitive to go to the end of the candidate, because for a human reading the word align is much, much more eaosier than n}
It goes even worse when I want to edit a word inside it. If I type "doucmentation" and want to fix my typo, I'd usually type "douc", then edit. However, instead of that, I have to type C-f C-f C-d C-d to change that. In this situation, it's easier to go to the end of candidate, too, because with the default behavior you have to skip the "douc" in your mind and then read the "mentation". This is obviously less intuitive.
This would also add #224 functionality, btw.
There are indeed situations where going to the beginning of the candidate is easier (like when you need to change "there" to "There", but in my opinion, this barely happens. This is why there should be a variable that controls that, so that the user could make a simple function with a let that goes to the beginning of that candidate.

@irigone irigone changed the title [Question] Go to the end of a candidate instead of the beginning [Feature request] Go to the end of a candidate instead of the beginning Dec 5, 2020
@a13
Copy link

a13 commented Dec 16, 2020

It goes even worse when I want to edit a word inside it

why don't you use avy-goto-char-timer for that? the algorithm could be

M-x avy-goto-char-timer, c, "jump letters", C-t (to transpose)

@a13
Copy link

a13 commented Dec 16, 2020

avy-goto-char-timer and type "align"

avy-goto-char-timer doesn't support multiple letters, are you sure you're not using avy-goto-word or something like that?

in your case I'd just use M-x avy-goto-char-timer, SPC, "jump", *

@irigone
Copy link
Author

irigone commented Dec 16, 2020

avy-goto-char-timer doesn't support multiple letters, are you sure you're not using avy-goto-word or something like that?

The documentation string says that it does?

avy-goto-char-timer is an autoloaded interactive compiled Lisp
function in ‘avy.el’.

It is bound to C-'.

(avy-goto-char-timer &optional ARG)

Read one or many consecutive chars and jump to the first one.
The window scope is determined by ‘avy-all-windows’ (ARG negates it).

in your case I'd just use M-x avy-goto-char-timer, SPC, "jump", *

I don't understand your solution. This is how I see your comment:

  1. M-x avy-goto-char-timer
  2. Type "align"
  3. Wait for avy-goto-char-timer to stop
  4. IDK.

I have problems with English...

@irigone
Copy link
Author

irigone commented Dec 16, 2020

Or maybe

  1. M-x avy-goto-char-timer
  2. Type SPC
  3. Type "align"
  4. Jump (whatever this means)
  5. Type the asterisk
    This won't work because SPC is registered as a space character, and thus the {align} will not be considered a candidate at all.

@irigone
Copy link
Author

irigone commented Dec 16, 2020

I can wrap around avy-goto-char-2 because it always uses 2 characters so... the issue is solved for me, but I really wish I could use goto-char-timer...

@irigone
Copy link
Author

irigone commented Dec 16, 2020

This solves the issue for me. I read the source code. Yay, I'm (kinda) learning Lisp!

(defun avy-goto-char-timer-end (&optional arg)
  "Read one or many consecutive chars and jump to the last one.
The window scope is determined by `avy-all-windows' (ARG negates it)."
  (interactive "P")
  (avy-goto-char-timer arg)
  (forward-char (length avy-text)))

Edit 2020-12-17 04:05 AM GMT+6: length as forward-char argument instead of dotimes.

@irigone irigone closed this as completed Dec 16, 2020
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

No branches or pull requests

2 participants