vim-exchange
vim-exchange copied to clipboard
Clipboard error happens when used in NeoVim in WIN10
I used this plugin in NeoVim
, when I did the exchange via cxiw
, I got the error information shown below:
clipboard: error invoking win32yank.exe: thread 'main' panicked at 'called
Result::unwrap()
on anErr
value: WinAPI Error(1418)', src\libcore\result.rs:859 note: Run withRUST_BACKTRACE=1
for a backtrace.
I tried to add one line in the source code, or comment one call s:restore_reg()
, then, the error is gone.
51 call s:restore_reg('*', reg_star)
52 sleep 100m
53 call s:restore_reg('+', reg_plus)
In another hand, I try the same action in VIM
, there is no error happened.
The exchange triggers double Cmd+C keypress on macOS which in my case opens up the Reverso app. Really enjoying
I also have a noisy cmdline in Linux (Arch 6.4.12-arch1-1
) and NeoVim
While it appears that the plugin works perfectly, almost every use of cx
gives one of these two error messages:
clipboard: error: Error: target STRING not available
clipboard: error invoking xclip: Waiting for selection requests, Control-C to quit Waiting for selection request number 1
I suspect this NeoVim issue is very relevant: https://github.com/neovim/neovim/issues/7054
Especially comment by jamessan (2017):
The clipboard provider was recently changed to display the provider's stderr via :echomsg so that there's a way for users to get error information. Apparently xclip, even with -quiet specified (unless you overwrote the command), dumps non-error data to stderr.
However I can't really gather what I should do to fix the issue. I don't understand how the system clipboards are even relevant in this plugin, so I tried to just swap *
with a
and +
with b
in the script and everything looks like it works like it should.
Here is the commit: https://github.com/tuurep/vim-exchange/commit/e5af0b9bcd83d7b85a4cd6c2c860beb0b00915d1
Edit:
Ah yes, the script doesn't explicitly set anything to reg a
or reg b
so I might as well remove the save_reg
and restore_reg
lines for *
and +
.
Therefore this is not a fix.