The default mapping of SPC in minibuffer is (self-insert-command N). However, I prefer SPC to simply type a single space (for instance, in passing arguments to environments and commands within AuCTeX). Is there a way of unmapping SPC in the minibuffer, and remapping it to ?


No problem. Just bind SPC to self-insert-command in the minibuffer keymaps.

There are several such maps, depending on your Emacs version:

minibuffer-inactive-mode-map     minibuffer-local-completion-map  
minibuffer-local-filename-completion-map minibuffer-local-filename-must-match-map 
minibuffer-local-isearch-map     minibuffer-local-map             
minibuffer-local-must-match-filename-map minibuffer-local-must-match-map 
minibuffer-local-ns-map          minibuffer-local-shell-command-map 

But some of them inherit from others, so you can just bind the key in the parents. Start with minibuffer-local-completion-map. Probably that is the only one you need, but if not then try also minibuffer-local-must-match-map. Those are the two completion maps.

(define-key minibuffer-local-completion-map (kbd "SPC") 'self-insert-command)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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