diff options
author | Gregory Anders <8965202+gpanders@users.noreply.github.com> | 2024-06-11 13:18:06 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-11 13:18:06 -0500 |
commit | 3ad977f01d97e84b576e6965c5c9e4f75c10cb35 (patch) | |
tree | 352ed37a4738a1f5a78f892c77817e9937d58a28 /runtime | |
parent | 39d8651283c0458c20b755d2140c8a3cb7b581c5 (diff) | |
download | rneovim-3ad977f01d97e84b576e6965c5c9e4f75c10cb35.tar.gz rneovim-3ad977f01d97e84b576e6965c5c9e4f75c10cb35.tar.bz2 rneovim-3ad977f01d97e84b576e6965c5c9e4f75c10cb35.zip |
feat(terminal): add support for copying with OSC 52 in embedded terminal (#29117)
When libvterm receives the OSC 52 escape sequence it ignores it because
Nvim does not set any selection callbacks. Install selection callbacks
that forward to the clipboard provider, so that setting the clipboard
with OSC 52 in the embedded terminal writes to the system clipboard
using the configured clipboard provider.
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/news.txt | 3 | ||||
-rw-r--r-- | runtime/doc/nvim_terminal_emulator.txt | 17 |
2 files changed, 18 insertions, 2 deletions
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 2ff6b0302c..455b38b5fa 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -138,7 +138,8 @@ STARTUP TERMINAL -• TODO +• The |terminal| now understands the OSC 52 escape sequence to write to the + system clipboard (copy). Querying with OSC 52 (paste) is not supported. TREESITTER diff --git a/runtime/doc/nvim_terminal_emulator.txt b/runtime/doc/nvim_terminal_emulator.txt index a6ebc7e958..81bcd89146 100644 --- a/runtime/doc/nvim_terminal_emulator.txt +++ b/runtime/doc/nvim_terminal_emulator.txt @@ -164,7 +164,22 @@ directory indicated in the request. >lua To try it out, select the above code and source it with `:'<,'>lua`, then run this command in a :terminal buffer: > - printf "\033]7;file://./foo/bar\033\\" + printf "\033]7;file://./foo/bar\033\\" + +OSC 52: write to system clipboard *terminal-osc52* + +Applications in the :terminal buffer can write to the system clipboard by +emitting an OSC 52 sequence. Example: > + + printf '\033]52;;%s\033\\' "$(echo -n 'Hello world' | base64)" + +Nvim uses the configured |clipboard| provider to write to the system +clipboard. Reading from the system clipboard with OSC 52 is not supported, as +this would allow any arbitrary program in the :terminal to read the user's +clipboard. + +OSC 52 sequences sent from the :terminal buffer do not emit a |TermRequest| +event. The event is handled directly by Nvim and is not forwarded to plugins. ============================================================================== Status Variables *terminal-status* |