aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc
diff options
context:
space:
mode:
authorGregory Anders <8965202+gpanders@users.noreply.github.com>2023-11-16 12:21:24 -0600
committerGitHub <noreply@github.com>2023-11-16 12:21:24 -0600
commitdb57df04b6af03ad9dd0447ffc8e881c97a39732 (patch)
treefd72b412503290723072176c73a4b0deabd281a9 /runtime/doc
parent4bf47222c973c4bc935d6fde106329f8a0e103e3 (diff)
downloadrneovim-db57df04b6af03ad9dd0447ffc8e881c97a39732.tar.gz
rneovim-db57df04b6af03ad9dd0447ffc8e881c97a39732.tar.bz2
rneovim-db57df04b6af03ad9dd0447ffc8e881c97a39732.zip
feat(clipboard): enable OSC 52 clipboard provider by default (#26064)
Use the XTGETTCAP sequence to determine if the host terminal supports the OSC 52 sequence and, if it does, enable the OSC 52 clipboard provider by default. This is only done automatically when all of the following are true: 1. Nvim is running in the TUI 2. 'clipboard' is not set to unnamed or unnamedplus 3. g:clipboard is unset 4. Nvim is running in an SSH connection ($SSH_TTY is set) 5. Nvim is not running inside tmux ($TMUX is unset)
Diffstat (limited to 'runtime/doc')
-rw-r--r--runtime/doc/news.txt3
-rw-r--r--runtime/doc/provider.txt32
2 files changed, 25 insertions, 10 deletions
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index 98848f548f..2f48ebfeff 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -209,7 +209,8 @@ The following new APIs and features were added.
read escape sequence responses from the terminal.
• A clipboard provider which uses OSC 52 to copy the selection to the system
- clipboard is now bundled by default. |clipboard-osc52|
+ clipboard is now bundled by default and will be automatically enabled under
+ certain conditions. |clipboard-osc52|
• The 'termsync' option asks the terminal emulator to buffer screen updates
until the redraw cycle is complete. Requires support from the terminal.
diff --git a/runtime/doc/provider.txt b/runtime/doc/provider.txt
index 23bde05072..4759b1a52e 100644
--- a/runtime/doc/provider.txt
+++ b/runtime/doc/provider.txt
@@ -260,27 +260,41 @@ using OSC 52. OSC 52 is an Operating System Command control sequence that
writes the copied text to the terminal emulator. If the terminal emulator
supports OSC 52 then it will write the copied text into the system clipboard.
-This is most useful when using Nvim remotely (e.g. via ssh) as Nvim does not
-have direct access to the system clipboard in that case.
+Nvim will attempt to automatically determine if the host terminal emulator
+supports the OSC 52 sequence and enable the OSC 52 clipboard provider if it
+does as long as all of the following are true:
-Because not all terminal emulators support OSC 52, this provider must be opted
-into explicitly by setting the following |g:clipboard| definition: >lua
+ • Nvim is running in the |TUI|
+ • |g:clipboard| is unset
+ • 'clipboard' is not set to "unnamed" or "unnamedplus"
+ • $SSH_TTY is set
+ • $TMUX is unset
+
+If any of the above conditions are not met then the OSC 52 clipboard provider
+will not be used by default and Nvim will fall back to discovering a
+|clipboard-tool| through the usual process.
+
+To force Nvim to use the OSC 52 provider you can use the following
+|g:clipboard| definition: >lua
vim.g.clipboard = {
name = 'OSC 52',
copy = {
- ['+'] = require('vim.ui.clipboard.osc52').copy,
- ['*'] = require('vim.ui.clipboard.osc52').copy,
+ ['+'] = require('vim.ui.clipboard.osc52').copy('+'),
+ ['*'] = require('vim.ui.clipboard.osc52').copy('*'),
},
paste = {
- ['+'] = require('vim.ui.clipboard.osc52').paste,
- ['*'] = require('vim.ui.clipboard.osc52').paste,
+ ['+'] = require('vim.ui.clipboard.osc52').paste('+'),
+ ['*'] = require('vim.ui.clipboard.osc52').paste('*'),
},
}
<
Note that not all terminal emulators support reading from the system clipboard
(and even for those that do, users should be aware of the security
-implications), so using OSC 52 for pasting may not be possible.
+implications), so using OSC 52 for pasting may not be possible (and not
+necessary, because you can |paste| instead using your system paste function).
+Users may need to configure their terminal emulator to allow reading from the
+clipboard.
<
==============================================================================
Paste *provider-paste* *paste*