I'm using emacs -nw
(Emacs 24.5, Ubuntu 16.04). And I found that the default emacs M-w
C-y
keys don't work interchangeably with the operating system.
After some research, it seems that the most comprehensive solution is to use simpleclip. EmacsWiki says that
simpleclip
You can use https://github.com/rolandwalker/simpleclip which ALWAYS works.
But looking into its usage guide above, simpleclip
makes use of a set of keys that are completely different from the default M-w
C-y
or the OS Ctrl-Shift-c
, Ctrl-Shift-v
for copy-paste
;; Press super-c to copy without affecting the kill ring.
;; Press super-x or super-v to cut or paste.
I don't really want to use super
key a lot with my PC keyboards, and don't want to remember (or persuade others to remember) yet another set of copy-paste keys.
For the GUI emacs, I can copy something in emacs and paste it into another terminal without any configuration. Mostly, I don't feel that Emacs is any different from gedit
except that the emacs copy-paste keys M-w
C-y
can be used in addition.
In the terminal mode, most of it breaks down. If I use OS copy (Ctrl-Shift-c
), one line in emacs can be copied into two or more lines in a target terminal because the line is too long. contents copied using M-w
simply do not paste into other programs, even though I tried to set certain variables following other SO questions, e.g.:
(setq x-select-enable-clipboard t)
I'm not very familiar with elisp. My question:
How can I customize or configure simpleclip
so that copy-paste in emacs -nw
is exactly the same as copy-paste in the OS?
Other related SO questions: