Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add OSC 52 clipboard support #14995

Open
peterwu opened this issue Jun 13, 2024 · 4 comments
Open

add OSC 52 clipboard support #14995

peterwu opened this issue Jun 13, 2024 · 4 comments

Comments

@peterwu
Copy link

peterwu commented Jun 13, 2024

A recent PR feat(clipboard): add OSC 52 clipboard support #25872 allows Neovim v0.10 to support both copy and paste operations using OSC52.

It's trivial to implement the copy operation with Vimscript but it's quite difficult to implement the paste operation without some changes.

If I understand it correctly, Neovim basically repurposes the TermReponse event to capture the content sent from the terminal after the right paste escape chars are written to the terminal. neovim/neovim#25868

Is your feature request about something that is currently impossible or hard to do? Please describe the problem.
It's difficult to use the existing VIM features to support the OSC52 paste operation, esp. the part where the content from the terminal can't be easily captured and made available.

Describe the solution you'd like
Implement OSC52 copy and paste natively and provide g: options for configuration (e.g. on/off)

Describe alternatives you've considered
Use a 3rd party program, such as this one (https://github.com/theimpostor/osc) to help capture the pasted content via a call to system().

@zeertzjq
Copy link
Member

Note: Nvim's TermResponse event is completely different from Vim's TermResponse and TermResponseAll.

@peterwu
Copy link
Author

peterwu commented Jun 13, 2024

For completeness, this is the PR where Neovim repurposed TermReponse.

neovim/neovim#25868

@chrisbra
Copy link
Member

This migh be a big complicated, because typically terminal escapes can occur later, even withing other events that need to be handled. I have no idea how complex setting this up.

@peterwu
Copy link
Author

peterwu commented Jun 15, 2024

maybe add a new code to handle osc52 paste in TermResponseAll?

:help TermResponseAll already warns

	Note that this event may be triggered halfway
	executing another event, especially if file I/O,
	a shell command or anything else that takes time
	is involved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants