neovim/neovim — pull request #1182 by bfredl (2014-09-15 16:58:47+00:00)
Title: [RFC] providers/clipboard: let provider distinguish between '+' and '*' register

This change allows clipboard provider to distinguish between `+` and `*` registers, by passing an extra parameter to clipboard_get/set.

Existing behaviour can be preserved by just igoring the extra parameter like [this](https://gist.github.com/bfredl/19c13ba8014bb761528c). An example provider for X11 that distinguishes between "primary selection" and clipboard (like in vim +x11) is [here](https://gist.github.com/bfredl/888e2b7c2b378d6953ee)

An open question is what to do when `unnamedclip` is set; right now it uses the name `+` (because it was easiest to implement and consistent with existing code). An alternative would be to pass the name `"` to the provider when the unnamed register is used (so it could choose between `+`/`*` itself, or implemnt a third option). In this case, and if I understand the code correctly, `adjust_clipboard_register` could be be completely removed? @tarruda

While breaking the API, something to consider is to let the provider get/set the regtype (character or linewise selection) by passing another parameter. I suppose this could be done by just doing `vim.command("call getregtype(...)")` from the provider, but IMHO it would be cleaner if this was actually part of the api. I will try to implement this later.