laktak / extrakto

extrakto for tmux - quickly select, copy/insert/complete text without a mouse
MIT License
878 stars 45 forks source link

Utilise native support for OSC 52 with the -w option - Fixes #92 #93

Closed hegga closed 2 years ago

hegga commented 2 years ago

This uses the -w option for the set-buffer command which implements OSC 52 support. This fixes my issue in #92.

laktak commented 2 years ago

Thanks for looking into this.

I can't merge it as it is because

Could you use the clip_tool_run parameter like this?

copy() {
    if [[ "$clip_tool_run" == "fg" ]]; then
        # run in foreground as OSC-52 copying won't work otherwise
        tmux set-buffer -- "$1"
        tmux run-shell "tmux show-buffer|$clip_tool"
    elif [[ "$clip_tool_run" == "osc-52" ]]; then
        # use tmux OSC 52 copy
        tmux set-buffer -w -- "$1"
    else
        # run in background as xclip won't work otherwise
        tmux set-buffer -- "$1"
        tmux run-shell -b "tmux show-buffer|$clip_tool"
    fi
}
hegga commented 2 years ago

Sure, @laktak! I've updated the PR accordingly.