How to set SPC to act as Enter in minibuffer mode?

319 Views Asked by At

When I edit in minibuffer mode, I must press Enter to exit minibuffer.

But I prefer to use Space.

  1. "Space" completes word again and again.

  2. When the message is "Sole Completion", press Space to exit minibuffer.

Defaullt Space key in the second step cannot exit minibuffer, I remap it , but it not works at all.

(define-key minibuffer-local-map (kbd "SPC") `minibuffer-complete-and-exit)

any idea?

1

There are 1 best solutions below

0
On BEST ANSWER

Need to define a key in the minibuffer-local-completion-map:

(define-key minibuffer-local-completion-map (kbd "SPC") 'minibuffer-complete-and-exit)