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 <mikoto2000@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
mikoto2000
2026-03-01 19:23:34 +00:00
committed by Christian Brabandt
parent 8526d32647
commit 5a4291d34e
2 changed files with 17 additions and 9 deletions
+4 -3
View File
@@ -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:
+13 -6
View File
@@ -3,7 +3,7 @@ vim9script
# Vim plugin for OSC52 clipboard support
#
# Maintainer: The Vim Project <https://github.com/vim/vim>
# 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<any> = {
"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)