-
-
Notifications
You must be signed in to change notification settings - Fork 110
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
Is it possible to quit avy-goto-char-timer with Esc (C-[) ? #249
Comments
Should work now, thanks. |
I think maybe we can add this kind of feature to other avy command? I use avy-goto-char-2 a lot, sometimes I'll make a typo when inputting the first character, maybe we can bind backspace to restart the command(e.g. pressing backspace will restart avy-goto-char-2 when avy is waiting for the second char to be inputted), and bind C-[ to totally quit avy command like C-g (many evil-user used to press C-[ to quit) |
I make a simple change to avy-goto-char-2,C-[ for quit,and C-h for restart avy-goto-char-2 when waiting for second character to be inputted, do you think this idea will be useful or it's not worth doing it? (defun avy-goto-char-2 (char1 char2 &optional arg beg end)
"Jump to the currently visible CHAR1 followed by CHAR2.
The window scope is determined by `avy-all-windows'.
When ARG is non-nil, do the opposite of `avy-all-windows'.
BEG and END narrow the scope where candidates are searched."
(interactive (list (let ((c1 (read-char "char 1: " t)))
(cond ((= c1 27)
(keyboard-quit))
((= c1 8)
(keyboard-quit))
(t c1)))
(let ((c2 (read-char "char 2: " t)))
(cond ((= c2 27)
(keyboard-quit))
((= c2 8)
(keyboard-escape-quit)
(call-interactively 'avy-goto-char-2))
(t c2)))
current-prefix-arg
nil nil))
(when (eq char1 ?)
(setq char1 ?\n))
(when (eq char2 ?)
(setq char2 ?\n))
(avy-with avy-goto-char-2
(avy--generic-jump
(regexp-quote (string char1 char2))
arg
avy-style
beg end))) |
It's a good change, I think. But it needs to be made more generic. To make it more customizable and reduce code duplication. |
Hmm, can we also have
|
@abo-abo It doesn't. I have defined |
You mean |
I'm not sure how
I can see that the |
@amosbird Please show the code for this. |
@abo-abo In terminal emacs, |
@amosbird I tried your code, but Emacs became nearly unusable: the meta key no longer works. What's key does "\033" translate to? Anyway, you can now customize |
I don't know how it works either... Thanks for the commit. I'll give it a try. |
In avy-goto-char-timer, typing Esc or C-[ will be read as string " ^[ " , and then avy will search for "^[", which is very useless since it will always get zero candidates. I want to let Esc has other functionality like quitting search as C-g or maybe ending input immediately like RET. How can I implement this?
The text was updated successfully, but these errors were encountered: