I use VSCode on macOS, I ssh into Linux remote station and here I run tmux (inside VSCode integrated terminal). However, I am not able to copy any text from tmux into system clipboard when used like this. I am not even able to select the text using mouse – when I select any the selection highlight disappears immediately.
The copying to system clipboard works if:
- I run tmux inside separate window of iTerm2
- I run normal zshell inside VSC integrated terminal
How to copy text from tmux inside VSC integrated terminal?
2
Answers
Solved using the mouse while holding Alt (Option) key. This way I can copy text from Tmux inside VSCode.
That is because vscode terminal does not support osc52. We gotta wait for this issue to be resolved https://github.com/xtermjs/xterm.js/issues/3260
OSC 52 (OSC stands for Operating System Command, a category of ANSI escape sequences which instruct the terminal emulator to perform certain actions) is a terminal sequence used to copy printed text into clipboard, without which copying from remote machine will not send the result to your local clipboard. Applications like tmux support it (actually, tmux is kinda forwarding it), iterm2 support it but not vscode