Last active
December 25, 2022 07:26
-
-
Save ljjjustin/635f520abe4cb2861b3962d0df544295 to your computer and use it in GitHub Desktop.
use channel to send yanked content
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! s:send2ssh() | |
if has("nvim") | |
let ch = sockconnect('tcp', '127.0.0.1:22222') | |
if ch == 0 | |
echomsg "failed to connect 127.0.0.1:22222" | |
endif | |
call chansend(ch, getreg('"')) | |
call chanclose(ch) | |
else | |
let ch = ch_open('127.0.0.1:22222') | |
if ch_status(ch) != "open" | |
echomsg "ssh channel is not open, status = " .. ch_status(ch) | |
endif | |
call ch_sendraw(ch, getreg('"')) | |
call ch_close(ch) | |
endif | |
endfunction | |
augroup pbcopy | |
au! | |
au TextYankPost * if v:event.operator ==# 'y' | call s:send2net() | endif | |
augroup END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment