0

Linux Mint 20

Emacs 27.1

Install package: Consult, Vertico, Embark

Steps:

M-x shell

enter image description here

Input

cat test.

and press TAB

enter image description here Open window *Completions* with possible candidates. Nice... but the cursor is not focus on this buffer. Cursor is still stay on shell buffer. So as result I need to press M-<arrow down> (windmove-down) to switch to window *Completions* and select desire candidate. enter image description here

It's not very convenient. Is it possible when press TAB to automate switch to window *Completions* ?

4
  • 1
    What I do is to use the completions window to figure out how much to type before pressing TAB again to restrict the choices further. E.g. here if you want the first file, type a TAB RET. I find that much faster than switching windows (although I do that too occasionally when I decide it would take too much typing - but I certainly don't want it done automatically).
    – NickD
    Commented Sep 17, 2021 at 15:04
  • @NickD This help: (setq completion-in-region-function (lambda (&rest args) (apply (if vertico-mode #'consult-completion-in-region #'completion--in-region) args))) Commented Sep 19, 2021 at 15:02
  • Can you explain? What does this help? Is it an answer to your question? (if so, you should make it a proper answer).
    – NickD
    Commented Sep 19, 2021 at 16:51
  • @NickD I added my anser Commented Sep 19, 2021 at 17:24

1 Answer 1

0

Here solution: In my init.el

(require 'consult)

;; Auto switch to buffer *Completition* when press TAB.
;; Use `consult-completion-in-region' if Vertico is enabled.
;; Otherwise use the default `completion--in-region' function.
(setq completion-in-region-function
      (lambda (&rest args)
        (apply (if vertico-mode
                   #'consult-completion-in-region
                   #'completion--in-region)
               args)))
    

Here help: consult-completion-in-region

1
  • If this answers your question, please accept this answer so the question will be removed from the "unanswered" queue
    – Tyler
    Commented Jun 11, 2023 at 21:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.