From 5a4291d34e9855c7c85a7486b50f1ecbac130daa Mon Sep 17 00:00:00 2001 From: mikoto2000 Date: Sun, 1 Mar 2026 19:23:34 +0000 Subject: [PATCH] runtime(osc52): Omit paste from the osc52 provider when g:osc52_disable_paste is enabled Omit paste capability from the osc52 provider when g:osc52_disable_paste is enabled This avoids OSC 52 paste queries on unsupported terminals and prevents the +/* registers from being treated as empty. Documentation updated accordingly. related: #18983 closes: #19542 Signed-off-by: mikoto2000 Signed-off-by: Christian Brabandt --- runtime/pack/dist/opt/osc52/doc/osc52.txt | 7 ++++--- runtime/pack/dist/opt/osc52/plugin/osc52.vim | 19 +++++++++++++------ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/runtime/pack/dist/opt/osc52/doc/osc52.txt b/runtime/pack/dist/opt/osc52/doc/osc52.txt index 97a63289ce..7ac73c076d 100644 --- a/runtime/pack/dist/opt/osc52/doc/osc52.txt +++ b/runtime/pack/dist/opt/osc52/doc/osc52.txt @@ -62,9 +62,10 @@ setting |g:osc52_force_avail| to true. *g:osc52_disable_paste* If your terminal does not support pasting via OSC 52, or has it disabled, then -it is a good idea to set g:osc52_disable_paste to TRUE. This will cause an -empty string to be returned when Vim attempts to query the osc52.vim provider, -instead of doing a blocking wait, as said in |osc52-support|. +it is a good idea to set g:osc52_disable_paste to TRUE. This will register +only the "copy" method for the osc52.vim clipboard provider, so Vim will not +attempt an OSC 52 paste query and avoids the blocking wait described in +|osc52-support|. ============================================================================== vim:tw=78:ts=8:fo=tcq2:ft=help: diff --git a/runtime/pack/dist/opt/osc52/plugin/osc52.vim b/runtime/pack/dist/opt/osc52/plugin/osc52.vim index 66b5752e53..0ae16376a5 100644 --- a/runtime/pack/dist/opt/osc52/plugin/osc52.vim +++ b/runtime/pack/dist/opt/osc52/plugin/osc52.vim @@ -3,7 +3,7 @@ vim9script # Vim plugin for OSC52 clipboard support # # Maintainer: The Vim Project -# Last Change: 2025 Dec 18 +# Last Change: 2026 Mar 01 if !has("timers") finish @@ -11,18 +11,25 @@ endif import autoload "../autoload/osc52.vim" as osc -v:clipproviders["osc52"] = { +var provider: dict = { "available": osc.Available, - "paste": { - "*": osc.Paste, - "+": osc.Paste - }, "copy": { "*": osc.Copy, "+": osc.Copy }, } +if !get(g:, 'osc52_disable_paste', 0) + provider->extend({ + "paste": { + "*": osc.Paste, + "+": osc.Paste + } + }) +endif + +v:clipproviders["osc52"] = provider + def SendDA1(): void if !has("gui_running") && !get(g:, 'osc52_force_avail', 0) && !get(g:, 'osc52_no_da1', 0)