keypoint
in init.vim, use '+': ['tmux', 'load-buffer', '-w', '-']
instead of '+': ['tmux', 'load-buffer', '-']
, (shown in :help g:clipboard
) ,
then ctrl-v
on local win10 gets want you copied with "+y
in nvim.
About my network
I use win10 as my local machine, ssh to a ubuntu machine in the campus (through a VPN, with the help of a software called easy connection).
On the local machine, this works: ssh my_ubuntu_user@10.103.23.66
(using pwsh7, windows terminal).
Then in the remote shell, echo $SSH_CLIENT
gets 10.11.220.32 50859 22
; let's denote 10.11.220.32
as win_ip
.
Still in the remote shell, ssh -v win_ip
gets :
.....something ...
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to win_ip [win_ip] port 22.
ssh: connect to host win_ip port 22: Connection timed out
If I use wsl2 (ubuntu) on the same local machine to that remote machine, the same thing happens.
Also, scp
, xclip
, xlogo
fail.
tmux
In ~/.config//tmux/tmux.conf, I have:
bind -n M-v run-shell "tmux copy-mode"
bind 'v' run-shell "tmux copy-mode ; tmux send -X begin-selection"
bind -T copy-mode-vi 'y' send -X copy-selection-and-cancel
So if I press the sequence :
Alt-v
v
- and select some text (e.g. I_am_remote) with
h
j
k
or l
...
y
In tmux, ctrl-b
=
shows that "I_am_remote" is there(see fig.1), and ctrl-b
]
can paste "I_am_remote" .
In applications like chrome on local win10, ctrl-v
gets the selected text.
nvim and tmux
in init.vim, I have set g:clipboard.
:echo g:clipboard
gets
{
\ 'paste': {
\ '*': ['tmux', 'save-buffer', '-'],
\ '+': ['tmux', 'save-buffer', '-'],
\ },
\ 'cache_enabled': 1,
\ 'name': 'ClipboarD-no-x11',
\ 'copy': {
\ '*': ['tmux', 'load-buffer', '-w', '-'],
\ '+': ['tmux', 'load-buffer', '-w, '-'],
\ },
\ }
then ctrl-v
on local win10 gets want you copied with "+y
in nvim.
ps: "+y
sometimes makes nvim show:
clipboard: error invoking xclip: Error: Can't open display: win_ip:47
Even with the error message, "I_am_remote" can be found byctr-b
=
or ctrl-b
]
.
xclipboard
that takes over the selection from the client providing it. – dirkt Jan 03 '18 at 10:38