1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2025-12-12 15:34:50 +08:00

feat(clipboard): tmux: send clipboard to client when using clipcopy

From `man tmux`:

```
load-buffer [-w] [-b buffer-name] [-t target-client] path
             (alias: loadb)
       Load the contents of the specified paste buffer from path.
       If -w is given, the buffer is also sent to the clipboard
       for target-client using the xterm(1) escape sequence,
       if possible.  If path is ‘-’, the contents are read from stdin.
```

By adding '-w', we can get `load-buffer` (and `clipcopy`) to also send
the copied buffer to the client, allowing for easy copying tmux buffers
into the local client, which is useful in scenarios such as ssh+tmux
remote sessions.
This commit is contained in:
bretello 2025-11-28 10:50:16 +01:00
parent beadd56dd7
commit a62e4f0339
No known key found for this signature in database
GPG Key ID: 876AAC6290170FE7

View File

@ -82,7 +82,7 @@ function detect-clipboard() {
function clipcopy() { cat "${1:-/dev/stdin}" | termux-clipboard-set; }
function clippaste() { termux-clipboard-get; }
elif [ -n "${TMUX:-}" ] && (( ${+commands[tmux]} )); then
function clipcopy() { tmux load-buffer "${1:--}"; }
function clipcopy() { tmux load-buffer -w "${1:--}"; }
function clippaste() { tmux save-buffer -; }
else
function _retry_clipboard_detection_or_fail() {