My host machine is Windows, but I'm working in Linux virtualbox machine over ssh from mintty in MSYS2 environment. As you may know, in mintty you copy via C-insert and paste via C-S-insert. When I ssh from mintty to my linux guest and open in it Emacs (emacs-nox) I can paste with default shortcut for mintty, it triggers Emacs function xterm-paste. My problem is that I can not find way to copy, there's no xterm-copy function at all. Also there's no X so I can not use xsel as I used before.

So my question is how to copy to mintty clipboard from terminal emacs, is there any way? I always had problems with all those clipboard possibilities and can not figure it out.

  • if you run Emacs ≥22 with X support compiled in, you can simply use Emacs's default methods to copy into (M-w) and paste from (C-y) the clipboard, in the same manner as you do when working inside Emacs. – user17303 Oct 28 '17 at 22:10
  • I dont have X, I'm running headless linux vm. Or you meant install Emacs (not emacs nox) just run it with nw option? – sandric Oct 28 '17 at 22:50
  • it does not matter whether you run it with or without -nw, it cannot use X on the windows side anyways unless you install Cygwin/X or the like. But it has to be a version with X11 enabled, not emacs-nox. Only the X11 part gives the ability to cut'n'paste from/to a GUI terminal (xterm, mintty etc.) – user17303 Oct 28 '17 at 22:55
  • the „to a GUI terminal” above should have read „X clipboard” for clarity. Sorry. – user17303 Oct 29 '17 at 14:06

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.