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

Yank commands always append a newline character to the clipboard #17

Open
drowning-cat opened this issue Dec 12, 2024 · 2 comments
Open

Comments

@drowning-cat
Copy link

drowning-cat commented Dec 12, 2024

Yank commands, such as "+yiw or {Visual}"+y, append a newline to the clipboard. Even copying a single character adds a newline.

Currently I am using linux/wayland with wl-clipboard.

This issue can be patched with the following code:

elif (( $+WAYLAND_DISPLAY & $+commands[wl-paste] )); then
	zstyle :zle:evil-registers:'\*' put  - wl-paste -p -n
	zstyle :zle:evil-registers:'+'  put  - wl-paste -n
	zstyle :zle:evil-registers:'\*' yank - wl-copy -n -p # PATCH: added '-n'
	zstyle :zle:evil-registers:'+'  yank - wl-copy -n    # PATCH: added '-n'

It’s possible that a newline is being added somewhere in the plugin.
It may work this way with another clipboard adapters.

xPMo added a commit that referenced this issue Dec 12, 2024
We will need to manually add newlines to linewise yanks.
@xPMo
Copy link
Member

xPMo commented Dec 12, 2024

It's ($handler <<< $CUTBUFFER &), the <<< will add a trailing newline.

The only issue is that this would causes linewise yanks in Zsh to be interpreted as characterwise in (n)vim (see #2). I've made a branch which does not append a newline, but now we'll have to re-add the newline in any time there's a linewise yank.

@drowning-cat
Copy link
Author

drowning-cat commented Dec 12, 2024

Thanks for your work. I will use the newline branch for now.

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

No branches or pull requests

2 participants