Always Overrides unnamed buffer when sync_clipboard is disabled
kevintraver opened this issue · comments
When sync_clipboard
is disabled, there is no way to set the unnamed register
Example:
lua vim.fn.setreg('"', 'some text to copy')
Then trying to paste:
p
will return whatever is in the tmux buffer instead of register "
hmm,
the documentation states that the option is overwriting regs * and +.
-- sync clipboard overwrites vim.g.clipboard to handle * and +
-- registers. If you sync your system clipboard without tmux, disable
-- this option!
sync_clipboard = true,
The " reg is a little bit special, because it gets overwritten with everything (even using setreg). Thus, syncing from tmux is overwriting " every time. We can only handle this case, if we read the " beforehand and set it back after the sync has taken place. The question is if it is applicable cause doing so would prevent dd in one nvim and p" in the second.
Kind regards
Alexander
PS: I leave the report open. You can close it or we use it to track a pr (if you need that option configurable).
Heres an example of where this in issue:
Notice nvim-tree copies to the "
clipboard, but as soon tmux.nvim changes the window the copy_sync
will override the "
register
hmm, is this really the vim way for handling copies?
(plz dont get me wrong, im unsure what the vim way is in this situation)
We could get this fixed by syncing " in advance if the latest tmux buffer != " or ignore the " which would destroy dd -> change nvim instance -> p.