-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
Add better keybindings for consult-completing-read-multiple
#353
Comments
For reasons I can't yet determine, I'm having problems testing the merged version! My test script doesn't appear to update consult correctly, and if I just add this to my doom config (after an update), I get a |
I changed the |
I just updated again, which pulled in a subsequent commit, and it works now; that error goes away. I guess this is related to earlier discussions, but ... Except now testing Selecting just one does work. But other than that, looks good! |
Great. It was probably an update issue.
Yes, this is the same as in vertico-crm. Support for multiple candidates must be implemented on the side of Embark. I also added the enhanced keybindings now (TAB/RET) for Vertico and Selectrum in 4e553d5. |
The keybindings work well. Can you not add the hint to use TAB to select the candidates, as you had in vertico-crm? |
Yes, I could add the hint. On the other hand Consult also doesn't show narrowing hints, e.g. |
OK.
Yes it does! Forgot about that ... I guess one thing you can't do is the One other little thing: I notice the face for the selected candidates does not extend the width of the window, while vertico-current does. Is that you, or the theme? |
I could but I think it is better to keep it simple for now. You can try this (defun consult-vertico--crm-select ()
"Select/deselect candidate."
(interactive)
(let ((content (minibuffer-contents)))
(run-at-time 0 nil (lambda ()
(insert content)
(vertico--exhibit))))
(when (let ((cand (vertico--candidate)))
(and (vertico--match-p cand) (not (equal cand ""))))
(vertico-exit)))
Yes this is due to how |
OK.
If not possible, so be it, but I think better would be to distinguish that with the styling of the face itself, rather than the relative width. I don't really understand the Emacs styling system though; what's possible, and what's not. In the Doom-one theme, they appear to be exactly the same gray background, so it looks odd for both reasons: because the theme has no distinction between the faces visually, and because one is shorter than the other. So I end up with: |
This is an oddity due to your special candidate strings I think. If you compare, |
OK, I'll experiment. |
@minad do you have any suggestions for how I fix this on my end? Here's the key piece of code, I imagine. (propertize candidate-main) " "
(propertize candidate-suffix 'face 'bibtex-actions-suffix) " "
(propertize candidate-hidden 'invisible t))) So I have a face for the "suffix" part, but adding I do not have a face for the main part of the candidate though. Should I add one? If yes, with what definition? |
(hopefully this thread is new enough that commenting here isn't bad form) Why were the new keybindings removed in 49b6442? |
@iyefrat Sorry, the discussion is super scattered over vertico, bibtex-actions and consult. See here for the reasoning emacs-citar/citar#144 (comment). It is not worth the complication in the completion UI integration code. Actually I like the simplicity of the UI, just pressing RET. Only small downside is the double RET in the end, but I don't mind it. A cheap solution is this one: (define-key vertico-map [S-return] #'+vertico-double-ret)
(defun +vertico-double-ret ()
(interactive)
(run-at-time 0 nil #'vertico-exit)
(vertico-exit)) Probably I should add a EDIT: Added consult-crm-map. You can use this: (define-key consult-crm-map "\r" #'+vertico-crm-exit)
(define-key consult-crm-map "\t" #'vertico-exit)
(defun +vertico-crm-exit ()
(interactive)
(run-at-time 0 nil #'vertico-exit)
(funcall #'vertico-exit)) |
Gotcha, thanks! |
Added snippet to the wiki https://github.com/minad/consult/wiki#convenient-keys-for-consult-completing-read-multiple |
I think, FWIW, the previous behavior, and what was in the vertico-crm prototype, is better, in part because if a user now does hit Perhaps we should add that to the vertico module, @iyefrat? |
@bdarcus The snippet from the consult wiki should fix this. |
@minad @bdarcus after all this is sorted out I'll add it to the module. |
This is not easily possible I think. It requires a lot of UI specific modifications. I would like to keep it now like this and defer the issue until we find something better for acting on multiple candidates at once (oantolin/embark#253). |
@minad fair enough, but does adding the snippet work on your machine? When I add the snippet the keys lead to the usual vertico commands instead of what's on |
@minad yep, works! |
Follow up on #352
Relevant for consult-vertico/selectrum:
cc @bdarcus (You may want to give the basic version a thorough test for now with bibtex-actions)
The text was updated successfully, but these errors were encountered: