Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clipboard from SSH #2238

Open
scargill opened this issue Oct 6, 2021 · 26 comments
Open

Clipboard from SSH #2238

scargill opened this issue Oct 6, 2021 · 26 comments

Comments

@scargill
Copy link

scargill commented Oct 6, 2021

I'm sure this isn't a new problem but it is new to me.
I installed micro on Raspberry Pi 4 just this week using:

curl https://getmic.ro | bash

Up to date PI OS and up to date Windows - all works PERFECTLY - and I use the editor in an SSH session from Windows - the clipboard from Windows to the editor is failing completely. Yet on the main MICRO page we see:

As its name indicates, micro aims to be somewhat of a successor to the nano editor by being easy to install and use. It strives to be enjoyable as a full-time editor for people who prefer to work in a terminal, or those who regularly edit files over SSH.

Nano copies and pastes back and forth to Windows no problem..

Ideas?

Specifications

Commit hash:
OS:
Terminal:

@pkitszel
Copy link

pkitszel commented Oct 28, 2021

Same here, but from linux host to other linux machine.
xsel, xclip installed on both machines

tested on kitty and urxvt terminals.

micro v2.0.9 and v2.0.10

> show clipboard yields "external"

@pkitszel
Copy link

I managed to fix this for my case, X forwarding was needed.

So, when starting ssh session, you need to enable X11 forwarding, as described in #305, so just ssh -X followed by your usual args.

@scargill
Copy link
Author

I've been listening to this subject since I first discovered the otherwise excellent MICRO maybe a year or so ago. I use Windows 10 64 bit (11 as of yesterday) and Mobaxterm for SSH. Clipboard exchanges between Micro on my fully up to date Raspberry Pi ~(running micro as user pi) and Windows - are not a pleasant experience at all. I wonder if there is a definitive way around this. Windows users have decades of experience of control-C for copy and control-V for paste - I wonder if anyone can sort this issue out. I for one would not have a clue how ro initiate "X11 forwarding" as I simply press a button in Mobaxterm and select the IP address or hostname of the Pi to start the session., however, X-11 forwarding (in ADVANCED SETTINGS" is pre-ticked in Mobaxterm - always has been. Doesn't help me with copy and paste.
image

@pkitszel
Copy link

Could you start any GUI app, eg xterm? If not, problem is not related to micro :)

@scargill
Copy link
Author

scargill commented Nov 1, 2021

The gui on the Pi is not turned on as I use SSH to talk to the Pi from my PC (Mobaxterm - as above - x11-forwarding is enabled).

@scargill
Copy link
Author

scargill commented Nov 1, 2021

With xcel and xclip installed on the SSH-connected RPI, I just went into a text file in micro and used control-C to copy a part of the text. The bottom of the editor ssid "Copied selection". However as I went back to my PC and used control-V in Notepad++ - what was pasted was a URL I copied in Windows half an hour ago - so the clipboard from the RPI didn't get copied across to the PC. Further 0 Windows WIN+V shows all the items recently put into the clipboard and that does not include the RPi clipboard. So - I copied part of this message in Windows to the clipboard and what was pasted back into the RPI text file was the material originally copied in RPI, nothing from Windows... yet in NANO this all aorks seamlessly - no conditions. I'm not defending nano as, from a Windows user perspective it is awful compared to micro - APART from this important clipboard issue.

@scargill
Copy link
Author

scargill commented Nov 1, 2021

In Windows - if I take the text "this is it" and copy it.... and then SSH to my RPi, the centre mouse button (no as good as Ctrl-V but do-able) pastes that text straight into the RPI command line or if NANO is open - straight into NANO. Vice-versa, This piece of text "lua:comment" was just pasted into Windows Github from the RPI NANO editor. All works as it should - but not in MICRO.

@cocoshka
Copy link

cocoshka commented Nov 7, 2021

Forcing micro to use terminal clipboard worked for me!

Just run with option micro -clipboard terminal or edit your micro config at ~/.config/micro/settings.json

{
    "clipboard": "terminal"
}

@scargill
Copy link
Author

Forcing micro to use terminal clipboard worked for me!

Just run with option micro -clipboard terminal or edit your micro config at ~/.config/micro/settings.json

{
    "clipboard": "terminal"
}

Well, I just installed micro on a new RPi, tried both of the above options and now on my PC (which connects to the RPi via SSH using Mobaxterm) - when I do my usual centre or right mouse button - which DOES paste into the likes of NANO, when I try "./micro -clipboard terminal" and do the same operation with the mouse, I get a line at the bottom of micro, black lettering, brown background which says "No clipboard received from terminal"

So, copy in Windows - move to SSH session, open nano, hit right-mouse, the content is pasted in. Close nano, open micro, right-click or centre click mouse - nothing comes in. Close micro, open nano, right-click mouse - that PC content still comes in.

This really needs resolving somehow....

@nkrepo
Copy link

nkrepo commented Nov 16, 2021

Forcing micro to use terminal clipboard worked for me!

Just run with option micro -clipboard terminal or edit your micro config at ~/.config/micro/settings.json

{
    "clipboard": "terminal"
}

I had the same issue.
Forcing micro to use terminal clipboard worked for also.
I am using micro 2.0.10 on Ubuntu 22.04 over Powershell Openssh with Windows Terminal.

@ca5ua1
Copy link

ca5ua1 commented Jan 13, 2022

Arch, KDE, Konsole
Host and remote machine - wayland.

Don't work at all.
No X11 forwarding, no installed clipboard tools, no different clipboard options helps. Shift won't work either. Remote machine only work with own clipboard, konsole prevent copying to host clipboard.

With X11 forwarding, clipboard can be extracted with xclip -o thou still don't copies to host machine by its own.
So, the workaround can be: https://stackoverflow.com/a/49890019 and its equivalents. Still pretty messy

@visortelle
Copy link

visortelle commented Jan 31, 2022

Trying to use micro with https://github.com/sorenisanerd/gotty and https://github.com/xtermjs/xterm.js/

Tried all the -clipboard options.
Clipboard paste works. The clipboard copy doesn't work.

Vim and nano in the same scenario work well.

Probably awaiting for this xtermjs/xterm.js#3260

@mrx23dot
Copy link

mrx23dot commented Feb 9, 2022

None of these work for me on Win+Kitty:
clipboard
external
terminal

why does it work without problem on nano? (no X11 setting is needed)

@Shura0
Copy link
Contributor

Shura0 commented Mar 28, 2022

I have the same issue with ssh access.
Home PC runs Ubuntu, remote PC runs Debian. Shell is zsh on both sides, xclip and xset are installed, but anyway micro gets error:
System clipboard not found, install xclip/xsel.

@hansratzinger
Copy link

Same for me. Using DietPi/ARMv8 64 on a Raspery Pi4 with xclip installed. Starting with micro -clipboard terminal does not work either. Copy/Paste works only in Linux not via SSH to Win10.

@scargill
Copy link
Author

October 2021 I first started this topic - it's looking like this isn't going to get fixed... I've reverted to other editors... shame.

@pkitszel
Copy link

Just noting that I've switched to > set clipboard terminal, and it works for me again (but I need use keyboard shortcut, scroll click not enough anymore).

@scargill , you know, it's a wider problem, not project specific

@emidevops
Copy link

No copy even with "set clipboard terminal" on Debian 11 (micro version : 2.0.8-1+b6).

@dzalf
Copy link

dzalf commented Oct 8, 2023

Hi guys

Any updates regarding this issue?

Facing the same problem:

System clipboard not found, install xclip/xsel or change 'clipboard' option

Changing the clipboard to terminal does NOT solve the problem on a RPi Zero W over SSH (puTTY)

Please solve this 🙏

@dimkasta
Copy link

dimkasta commented Oct 13, 2023

So far the only thing that works for me is to set "mouse": false on settings.json. Then micro behaves exactly like the rest of terminal apps, with right click opening a context menu or directly pasting, depending on your ssh/terminal settings.
It's a bummer to lose the click to move and click to multi-cursors though, but keybindings are kinda faster... Once you learn to move with the keyboard

@hgraur
Copy link

hgraur commented Mar 3, 2024

Environment: Windows 10 with Putty
I've tried with adding the "clipboard": "terminal" but it does not work.
The solution that I'm using is to press the Ctrl keypad while right clicking on the mouse. It will present the context menu where you can choose "Paste" and it works.

This way you don't have to disable mouse in micro.

@dimkasta
Copy link

dimkasta commented Mar 3, 2024

@hgraur nice. I just tried it and it works nicely.

On Windows 11 and git-bash I have to use shift though instead of ctrl

You can also use shift+Ins to paste from the host

@Diomas
Copy link

Diomas commented Jun 20, 2024

I've just discovered Ctrl+Shift+V does work with clipboard=terminal on debian with no x-forwarding, no xsel, no xclip (host is ubuntu)

@pkitszel
Copy link

pkitszel commented Jul 4, 2024

copying stopped working for me, but I have figured out how to fix, so, in my case the solution is to:
use ssh -X on your local side, ensure there is xsel and xauth installed on the remote side, and use set clipboard external there.

@scargill
Copy link
Author

scargill commented Jul 4, 2024 via email

@yqs112358
Copy link

Forcing micro to use terminal clipboard worked for me!

Just run with option micro -clipboard terminal or edit your micro config at ~/.config/micro/settings.json

{
    "clipboard": "terminal"
}

This works well for Windows Terminal and WSL2 🎉🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests