-
Can I copy/paste between a remote machine and my device? How do I enable OSC52 between a remote machine and my device? How can I copy text to the system clipboard across Mosh, SSH, tmux, screen, Emacs, and Vim? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
CLI applications, specially editors, regularly use their clipboard to perform copy or yank operations. OSC52 is an ANSI control sequence used to instruct the terminal to copy the string it carries to the system clipboard, even through remote connections over SSH and Mosh. Mosh supports the OSC52 sequence out of the box since version 1.4.0, so make sure your mosh-server is up to date. Then, you just need to instruct the specific CLI application to make use of the OSC52 sequence. Here is how to do so, and please chime in on this thread to add others! Vim:
then enable this setting:
Emacs:
TMUX:
|
Beta Was this translation helpful? Give feedback.
-
In addition to @iflowerml‘s answer, you can also use the osc tool on the command line:
Note that the |
Beta Was this translation helpful? Give feedback.
-
This instruction is very helpful for me and it worked well. |
Beta Was this translation helpful? Give feedback.
CLI applications, specially editors, regularly use their clipboard to perform copy or yank operations. OSC52 is an ANSI control sequence used to instruct the terminal to copy the string it carries to the system clipboard, even through remote connections over SSH and Mosh.
Mosh supports the OSC52 sequence out of the box since version 1.4.0, so make sure your mosh-server is up to date.
Then, you just need to instruct the specific CLI application to make use of the OSC52 sequence. Here is how to do so, and please chime in on this thread to add others!
Vim:
To enable copy/paste you’ll need to install ojroques/vim-oscyank and add the following line to
.vimrc
: