-
-
Notifications
You must be signed in to change notification settings - Fork 390
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
Action the # candidate directly [1-9] ? #1257
Comments
Chunyang Xu notifications@github.com writes:
This was existing in original version of "anything". |
Yes, I'd like to have it.
I've found it (controlled by variable
9 is just a reasonable default since its display-width is one and corresponding key bindings can be very straightforward, e.g., use M-1 ~ M-9 or C-1 ~ C-9.
This is a different way, though it might be handy as well. I want to count candidate from the beginning of helm-window (in other word, the first visible candidate to the user). |
Chunyang Xu notifications@github.com writes:
Agree.
Yes but with the linum-relative-mode it is exactly the same when |
Would this be disabled in helm-M-x where M-# would give a prefix argument to the candidate? Otherwise this sounds nice. |
issue-dispenser notifications@github.com writes:
Why ? The new function should accept prefix arg (just like helm-next-line |
Thierry Volpiatto thierry.volpiatto@gmail.com writes:
Of course M-n is not a good example for a key because it is itself a |
Here a sample code: (defun helm-execute-selection-action-at-nth (linum) (dotimes (n 9) With this you can do C-x 5 which execute default action on the 5th |
Yes, I think it's too commonly used as a prefix to be used as a special key here. Perhaps C-M-# (which also is globally bound to digit-argument) would be better than just M-# as it's probably used less commonly as a prefix arg. Your code seems to work nicely (I believe it has to be (dotimes (n 10)...). |
issue-dispenser notifications@github.com writes:
Yes of course and it would fail in helm-M-x (it will understand it as a
Hmm, no, in addition it is very difficult to type on non US keyboards
Yeah, I quickly wrote it as example, need to be polished. |
This feature would be nice. IIRC, |
I agree with @cute-jumper, this one would be a nice add. |
This would not be very helpful as some source popup with a preselection very far from the first 9 cands. |
…1257). * helm.el (helm-map): Bind keys from 1 to 9. (helm-execute-selection-action-at-nth): The function to jump to nth cand and execute action.
I have merged the code above (slighly modified), so one can now use it with linum-relative to visualize first and previous nine candidates. C-x => execute default action on number candidate before selection. |
Now linum-relative have a minor-mode (not global) and a global-minor-mode, so one can enable linum-relative only for helm with something like this: (defun helm--turn-on-linum-relative ()
(with-helm-buffer (linum-relative-mode 1)))
(define-minor-mode helm-linum-relative-mode
"Turn on linum-relative in helm.
Allow to execute default action on nth candidate.
Commands prefixed with C-x will use nth candidate before selection
the ones prefixed with C-c will use nth candidate after selection."
:group 'helm
(if helm-linum-relative-mode
(progn
(add-hook 'helm-after-initialize-hook 'helm--turn-on-linum-relative)
(add-hook 'helm-after-preselection-hook 'linum-relative-for-helm))
(remove-hook 'helm-after-initialize-hook 'helm--turn-on-linum-relative)
(remove-hook 'helm-after-preselection-hook 'linum-relative-for-helm)))
Don't know yet if I have to integrate such code in helm, will see. |
Once the mode enabled with (helm-linum-relative-mode 1) you will see the relative candidates numbers in your helm buffers, you can jump to the nine numbered candidates before or after current selection (the line highlighted in your helm buffer) by using C-x <n> for the ones before selection and C-c <n> for the ones after. see also: emacs-helm/helm#1257
Once the mode enabled with (helm-linum-relative-mode 1) you will see the relative candidates numbers in your helm buffers, you can jump to the nine numbered candidates before or after current selection (the line highlighted in your helm buffer) by using C-x <n> for the ones before selection and C-c <n> for the ones after. see also: emacs-helm/helm#1257 Signed-off-by: Yen-Chin Lee <coldnew.tw@gmail.com>
Closing now as |
Number the first 9 visible candidates and assign M-1 ~ M-9 for them, for example, M-5 to select
client.c
and execute its default action, this way a little more convenient than enter "client" into minibuffer to continue to filter or run C-n for 4 times.(I've tried to implemented for several times but have always ended in failure.)
The text was updated successfully, but these errors were encountered: