Linux has 2 clipboards. One is pasted by an application specific binding. Most commonly control + v but terminals commonly use control+shift+v, vim uses just p, emacs uses control +y.
The other clipboard is copied to by highlighting text and pasted from by clicking the middle mouse button.
If you want better control of the clipboard you can run a clipboard daemon like parcellite
http://parcellite.sourceforge.net/?page_id=2
Note that you don't want to install from source forge you want to use your package manager.
>r/macapps
Fair enough. For me Paste was too overwhelming as I never needed pins or categories - I always wanted something more minimalistic and lightweight. Something like Parcellite but for macOS.
I have these functions in Emacs config
;; Copy to clipboard
(defun copy-to-clipboard ()
"Copies selection to x-clipboard."
(interactive)
(if (display-graphic-p)
(progn
(message "Yanked region to x-clipboard!")
(call-interactively 'clipboard-kill-ring-save)
)
(if (region-active-p)
(progn
(shell-command-on-region (region-beginning) (region-end) "xsel -i -b")
(message "Yanked region to clipboard!")
(deactivate-mark))
(message "No region active; can't yank to clipboard!")))
)
;; Paste from clipboard
(defun paste-from-clipboard ()
(interactive)
(if (display-graphic-p)
(progn
(clipboard-yank)
(message "graphics active")
)
(insert (shell-command-to-string "xsel -o -b"))
)
)
and bind them to C-c c
to copy and C-c v
to paste.
I used parcelitte as clipboard manager and it's configured to sync all clipboard actions, so copy and paste are always synced with the clipboard.
My workflow has one or more Emacs open in my desktop and a lot o Emacs open in tmux session that I access using SSH. With these functions, xsel and parcellite it's simple to copy and paste over SSH and between Emacs GUI and console. Parcellite is started using exec --no-startup-id parcellite -n
in i3 config.
Maybe the easiest thing to do would be to edit xclip.el and in the the definition of xclip-select-text
change the line reading (xclip-set-selection 'primary text)
to (xclip-set-selection 'secondary text)
, and then eval that defun.
Another possibility would be to install and use a clipboard manager like parcellite and use its clipboard synchronization ability (see the option in its preferences when you right-click on the parcellite icon).
Another option would be to bind whatever key you use to copy to call (xclip-set-selection 'secondary)
.
My last idea is to try to figure out why (xclip-set-selection 'primary "foo")
isn't working for you. I don't have any ideas on that front at the moment. Maybe someone else here can chime in?
Not sure if it's because I'm running Parcellite, but middle click for me pastes from the regular clipboard if there's an addition to it that's more recent than the current selection. So I never use Shift+Insert.
What Linux distro you are using?
Build dependencies.
https://launchpad.net/debian/sid/+source/diodon
https://launchpad.net/ubuntu/utopic/+source/diodon
There are other clipboard managers out there. I have try a few.
My other choice would be