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

Clipboard error : Target STRING not available #16

Closed
rtucek opened this issue Jan 30, 2020 · 7 comments
Closed

Clipboard error : Target STRING not available #16

rtucek opened this issue Jan 30, 2020 · 7 comments

Comments

@rtucek
Copy link

rtucek commented Jan 30, 2020

Hi,

I've just started using the plugin. When starting neovim, I get the error Clipboard error : Target STRING not available. This only affects neovim, but not vim.

Googling around, I found neovim/neovim#2642 (comment), which relates to logic of monitoring the system's clipboard via yankrinkg.

And indeed, setting let g:yoinkSyncSystemClipboardOnFocus = 0 prevents this error.
Is there a way of having this fixed, while retaining the monitoring of the system's clipboard?

@rtucek
Copy link
Author

rtucek commented Jan 30, 2020

And yes, I'm using xclip.

@svermeulen
Copy link
Owner

What version of neovim?

@rtucek
Copy link
Author

rtucek commented Jan 31, 2020

Hi @svermeulen, thank you for looking into this!

I use Neovim v0.4.3

However, I think I've made some mistake. I claimed let g:yoinkSyncSystemClipboardOnFocus = 0 would prevent showing up the error. However, I noticed that even having the setting disabled, the error shows up occasionally.

@svermeulen
Copy link
Owner

I can't seem to reproduce this. I am on osx though so maybe it doesn't appear there. I am guessing that it occurs during the yoink#onVimEnter method though based on your description. If it's annoying enough, you could uncomment the yoink#addCurrentDefaultRegToHistory line in yoink#onVimEnter since I don't expect that is totally necessary

@rtucek
Copy link
Author

rtucek commented Feb 1, 2020

I've done more googling on the error and I think it's exclusively related to xclip (which is for interacting with the clipboard on Linux). So I doubt you'll encounter this on MacOS either. The issues I found don't relate to neovim/vim, but arise with similar interaction with the clipboard.

If you don't mind, I'll keep this issue open for more try'n'error feedback. I'll try out your suggested fix this weekend.

@yigitsever
Copy link

Seems like xclip is indeed the issue, removing it and using xsel fixed it for me but I have a xclip dependency. nvim tries to use xclip before xsel :h clipboard-tool. You can manually override the clipboard tool using;

let g:clipboard = {
      \   'name': 'xsel_override',
      \   'copy': {
      \      '+': 'xsel --input --clipboard',
      \      '*': 'xsel --input --primary',
      \    },
      \   'paste': {
      \      '+': 'xsel --output --clipboard',
      \      '*': 'xsel --output --primary',
      \   },
      \   'cache_enabled': 1,
      \ }

if you need to have both xsel and xclip AND you're using nvim. This snippet works with set clipboard+=unnamedplus as advised in :h clipboard.

g6ai added a commit to g6ai/dotfiles that referenced this issue Apr 28, 2021
namjul pushed a commit to namjul/dotfiles that referenced this issue Aug 10, 2021
fixes "clipboard: error: Error: target STRING not available"
svermeulen/vim-yoink#16
@rtucek
Copy link
Author

rtucek commented Sep 16, 2021

I haven't tried @yigitsever's solution, even several people report it fixed the issue for them. The main reasons are that I did not want to have xsel installed along xclip as well as the error wasn't that much an issue for me given it only happened sporadic.

However, after upgrading neovim I started encountering the error as reported in #28.

I think this is related to this issue... previously it just "used" to issue the small error Clipboard error : Target STRING not available but the more recent neovim version seems to have more troubles with it. I'm closing this issue though as we should continue with the thread in #28.

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

3 participants