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

After first ui attach event, modifications to g:clipboard won't register #13331

Open
yatli opened this issue Nov 20, 2020 · 4 comments
Open

After first ui attach event, modifications to g:clipboard won't register #13331

yatli opened this issue Nov 20, 2020 · 4 comments
Labels
bug issues reporting wrong behavior

Comments

@yatli
Copy link
Contributor

yatli commented Nov 20, 2020

version: NVIM v0.5.0-828-g0a95549d6

If the ui attaches first (and nvim finds another provider, say tmux), later :checkhealth reports FVimClipboardProvider because it sees the current g:clipboard, but nvim actually isn't using it.

Can be worked around with:

  1. Do not attach the UI until the initial let g:clipboard ... command returns; and:
  2. Do not hard-code client channel in g:clipboard -- instead, capture the channel variable with a lambda. Say "+": lines, regs -> rpcrequest(g:fvim_channel, lines, regs). So later attached clients can modify the variable to redirect the clipboard.
@yatli yatli added the bug issues reporting wrong behavior label Nov 20, 2020
@bfredl
Copy link
Member

bfredl commented Nov 20, 2020

probably changes to g:clipboard should be detected after startup (using dictwatcher)

@erw7
Copy link
Contributor

erw7 commented Dec 20, 2020

probably changes to g:clipboard should be detected after startup (using dictwatcher)

The dictwatcher only fires on assignment to a dictionary key. In order to do so, we need to implement a new autocommand or callback that fires on assignment to a variable.

In the meantime, I have added the following items to the FAQ.

https://github.com/neovim/neovim/wiki/FAQ#gclipboard-settings-are-not-used

@bfredl
Copy link
Member

bfredl commented Dec 20, 2020

@erw7 g: is also a dictionary, so you can set a watcher on a global variable already.

@erw7
Copy link
Contributor

erw7 commented Dec 21, 2020

I've added an example of using dictwatcher() to the FAQ. Should I add an implementation to autoload/provider/clipboard.vim that reloads with dictwatch()? IMO: Reloading with dictwatcher can cause performance problems, so it is better not to do it in autoload/provider/clipboard.vim.

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

No branches or pull requests

3 participants