How to paste system clipboard into minibuffer?

What happened?

Currently have these keybinds setup to copy / paste

(map!
 :nv
 "C-S-v" #'clipboard-yank)
(map!
 :nv
 "C-S-c" #'clipboard-kill-ring-save)


These keybinds don’t work when in minibuffer(ie i can’t paste system clipboard into minibuffer)

I’m not sure if minibuffer is the right word , what i mean is the input prompt you get when you press M-x or try to search something.

System information


Loading data dump...

Does it work if you use yank-pop to paste the last inserted item in your kill ring?

Yes(C-y pastes last selected item in killring to minibuffer), but it’s annoying having to first move my selection from system clipboard to the kill ring and then paste. Any way the first step could be skipped?

Would it would work for you using kill-ring-save and yank-pop?

Unsure about why it doesn’t work. By looking at the code for clipboard-kill-ring-save:

(defun clipboard-kill-ring-save (beg end &optional region)
  "Copy region to kill ring, and save in the GUI's clipboard.
If the optional argument REGION is non-nil, the function ignores
BEG and END, and saves the current region instead."
  (interactive "r\np")
  (let ((select-enable-clipboard t))
    (kill-ring-save beg end region)))

I suspect select-enable-clipboard may be connected? What’s its value in your config? I have it to t.

I have it set to nil(iirc it was because having it set to t made every word i deleted go directly into my system clipboard)

I think custom keybinds may not work when the minibuffer is open, not sure how i would invoke clipboard-yank if this is the case

Oh i figured it out , i had only mapped it in normal and visual mode. :skull:

The following works

(map!
 "C-S-v" #'clipboard-yank)
(map!
 "C-S-c" #'clipboard-kill-ring-save)


1 Like