12

Is there a way to paste something into the minibuffer?
For example if I want to eval-expression and paste something in there neiter C-v or (obviously p) will work? There has to be a way.

  • 2
    Have you tried C-y (which would be the Emacs standard key) ? – politza Aug 31 '16 at 23:36
  • I thought I had. That works. Thanks. – sebastian Sep 1 '16 at 8:10
8

C-y does work, but you can also paste into the minibuffer from the default register with, e.g., M-mre" or M-mrereturn--or by searching the contents of all registers: for example M-mre text copied a while ago.

M-m is the default dotspacemacs-emacs-leader-key: it's similar to SPC (which is the default dotspacemacs-leader-key), but the former is available where SPC would just insert a literal space character (like in the minibuffer). Personally, I've just set dotspacemacs-emacs-leader-key to a very easily accessible key chord and used it everywhere instead of SPC.

Currently, C-r doesn't access evil's registers from within the minibuffer (though it does work elsewhere).

EDIT: When in ex-mode (:), you can indeed use C-r to paste from a register into the minibuffer. Additionally, you can switch to evil's search module (evil-search-module) in order to enable the same when searching with /. The evil search module also enables evil-delete-backward-word within the search minibuffer (on C-w), as well as pasting the word under the non-minibuffer's cursor with C-rC-w.

EDIT: and if you're using ivy, M-mry (counsel-yank-pop -- this allows you to search your kill ring, which includes a lengthier history of copied text than the evil registers) also works in the minibuffer.

  • edited to reflect notable exceptions I was previously unaware of – braham-snyder Nov 26 '16 at 5:34
  • 1
    I've installed the git layer in spacemacs. When running maggit-clone I'm given a minibuffer asking for the repository URL. C-y pastes the " buffer for me, but if I try SPC-r-e-" in the minibuffer it just says "Whitespace is not allowed here" followed by typing re" Any suggestions? – bobpaul May 31 '17 at 17:11
  • @bobpaul I gave incorrect keybindings--thanks for the heads up. I've corrected my answer above. – braham-snyder May 31 '17 at 17:54

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.