summaryrefslogtreecommitdiff
path: root/core/vimrc
diff options
context:
space:
mode:
authorxs <xs@xs.local>2026-11-10 09:39:10 +0800
committerxs <xs@xs.local>2026-11-10 09:39:10 +0800
commit402a854a195ea1e63c622edeee5dbbc802441d53 (patch)
tree70529d4479db1509eccbc5845a80d51e9cb9a8c7 /core/vimrc
parent20e382dec315fb23bb3dda787247312fc355df9a (diff)
tmux, vimrc: yanks also go to the local terminal clipboard via OSC 52
tmux: set-clipboard on, so OSC 52 written by vim inside a pane is forwarded to the client terminal (external dropped it). vimrc: TextYankPost writes @" as OSC 52 next to the existing ssh push; base64 via the base64 command since base64_encode()/str2blob() are newer than vim 9.1.83.
Diffstat (limited to 'core/vimrc')
-rw-r--r--core/vimrc2
1 files changed, 2 insertions, 0 deletions
diff --git a/core/vimrc b/core/vimrc
index fee3ba3..26ebdb6 100644
--- a/core/vimrc
+++ b/core/vimrc
@@ -68,6 +68,8 @@ let g:clip = ['ssh', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=yes', '-o
68augroup ssh_clipboard 68augroup ssh_clipboard
69au! 69au!
70au TextYankPost * let g:clip_job = job_start(g:clip + ['umask 077; mkdir -p /dev/shm/clip && cat >/dev/shm/clip/new && mv /dev/shm/clip/new /dev/shm/clip/buf'], {'in_io': 'pipe', 'out_io': 'null', 'err_io': 'null'}) | call ch_sendraw(g:clip_job, @") | call ch_close_in(g:clip_job) 70au TextYankPost * let g:clip_job = job_start(g:clip + ['umask 077; mkdir -p /dev/shm/clip && cat >/dev/shm/clip/new && mv /dev/shm/clip/new /dev/shm/clip/buf'], {'in_io': 'pipe', 'out_io': 'null', 'err_io': 'null'}) | call ch_sendraw(g:clip_job, @") | call ch_close_in(g:clip_job)
71" also OSC 52: @" to the clipboard of the terminal you type in (inside tmux needs set-clipboard on)
72au TextYankPost * call echoraw("\e]52;c;" . system("base64 | tr -d '\\n'", @") . "\x07")
71augroup END 73augroup END
72" pull (paste): every p P gp gP ]p [p (normal) and p P (visual) first fetches the buffer into @". 74" pull (paste): every p P gp gP ]p [p (normal) and p P (visual) first fetches the buffer into @".
73" Waits up to 3 s for a pending push, then up to 3 s for the fetch (perl alarm kills ssh); 75" Waits up to 3 s for a pending push, then up to 3 s for the fetch (perl alarm kills ssh);