diff options
| author | Gregory Anders <greg@gpanders.com> | 2024-12-31 09:59:03 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-31 09:59:03 -0600 |
| commit | a389dc2f950ef89492dfc2d8334e421d2252cddf (patch) | |
| tree | 52173c06e3e4e95735e484ee3b554f12bd610ec3 /runtime/autoload | |
| parent | 0bef3b911cc262a007fb4412d864c1832d1268ad (diff) | |
| download | rneovim-a389dc2f950ef89492dfc2d8334e421d2252cddf.tar.gz rneovim-a389dc2f950ef89492dfc2d8334e421d2252cddf.tar.bz2 rneovim-a389dc2f950ef89492dfc2d8334e421d2252cddf.zip | |
feat(clipboard)!: use OSC 52 as fallback clipboard provider (#31730)
We currently enable the OSC 52 clipboard provider by setting g:clipboard
when a list of conditions are met, one of which is that $SSH_TTY must be
set. We include this condition because often OSC 52 is not the best
clipboard provider, so if there are "local" providers available Nvim
should prefer those over OSC 52.
However, if no other providers are available, Nvim should use OSC 52
even when $SSH_TTY is not set. When a user is in an SSH session then the
checks for the other clipboard providers will still (typically) fail, so
OSC 52 continues to be enabled by default in SSH sessions.
This is marked as a breaking change because there are some cases where
OSC 52 wasn't enabled before and is now (or vice versa).
Diffstat (limited to 'runtime/autoload')
| -rw-r--r-- | runtime/autoload/provider/clipboard.vim | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim index 848fa401f1..0bfd82f61d 100644 --- a/runtime/autoload/provider/clipboard.vim +++ b/runtime/autoload/provider/clipboard.vim @@ -169,6 +169,14 @@ function! provider#clipboard#Executable() abort let s:copy['*'] = s:copy['+'] let s:paste['*'] = s:paste['+'] return 'tmux' + elseif get(get(g:, 'termfeatures', {}), 'osc52') && &clipboard ==# '' + " Don't use OSC 52 when 'clipboard' is set. It can be slow and cause a lot + " of user prompts. Users can opt-in to it by setting g:clipboard manually. + let s:copy['+'] = v:lua.require'vim.ui.clipboard.osc52'.copy('+') + let s:copy['*'] = v:lua.require'vim.ui.clipboard.osc52'.copy('*') + let s:paste['+'] = v:lua.require'vim.ui.clipboard.osc52'.paste('+') + let s:paste['*'] = v:lua.require'vim.ui.clipboard.osc52'.paste('*') + return 'OSC 52' endif let s:err = 'clipboard: No clipboard tool. :help clipboard' |