Jesuspc
Jesuspc

Reputation: 1734

Copy-pasting in Spacemacs from within tmux in an ssh session

My current setup consists of an OS X host machine in which I run iTerm. From inside iTerm I ssh into a second machine in which I do all the development. In there I run tmux, and inside tmux I run Spacemacs.

The experience is quite smooth with the only exception of copy-pasting. When I copy/paste from inside emacs, it interacts with the second machine's clipboard. Is there any way make it also use the host's clipboard instead? I would imagine that for copying it could execute a hook after each yank that would send via ssh the copied text to "pbcopy" in the host machine, and for pasting it could have a custom registry that would use the host's "pbpaste", also via ssh.

Upvotes: 3

Views: 1376

Answers (1)

Jesuspc
Jesuspc

Reputation: 1734

I managed to make it work with an xclip integration.

First of all make sure that xclip is installed in your development machine. When you ssh into the development machine forward X11 with ssh -Y.

In the development machine, in dotspacemacs/layers, as dotspacemacs-additional-packages, add xclip:

dotspacemacs-additional-packages '(xclip)

Also in the development machine, in dotspacemacs/user-config add:

;; == Terminal ==
;; XClip integration

(require 'xclip)
(define-globalized-minor-mode global-xclip-mode
  xclip-mode xclip-mode)

(global-xclip-mode 1)

There is also an issue open in Spacemacs to add a layer to provide that functionality.

Upvotes: 2

Related Questions