Should fix #12419. Since we already have the clipmethod
option now, a new value called provider
is added, which uses the value of the option clipfunc
to copy/paste.
The first argument of the function would take the type of operation:
'p' for paste
'y' for yank/copy
... maybe more
The second argument is a dictionary containing operation specific key/value pairs.
For the paste operation, the function would return a tuple: (<flags>, <contents>), where could be what motion type to use, if the clipboard is cleared/empty, and maybe more. <contents> is just what to paste. It is up to the function/plugin to determine what encoding to use, and what mime type to use if there are ones, but it should be text.
One use case for this is obviously implementing an OSC 52 plugin (Maybe OSC 5522 too?).
This might change, I'll see as I work on this PR.
https://github.com/vim/vim/pull/17998
(6 files)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Just in case Nvim compatibility is considered, this is the document of g:clipboard
, which I think is equivalent with 'clipfunc'
that you propose. https://neovim.io/doc/user/provider.html#g:clipboard
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Just in case Nvim compatibility is considered, this is the document of
g:clipboard
in Nvim, which I think is equivalent with'clipfunc'
that you propose. https://neovim.io/doc/user/provider.html#g:clipboard
Looking at it, maybe there could be a v:clipboard
vim var that is a list of dictionaries (providers), each with a paste, copy, and a function that checks if the provider is available + a name for the provider. Then those names of the providers can be used in clipmethod
. Don't know if that is just overcomplicated but sounds straightforward enough
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 4 commits.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
and a function that checks if the provider is available
If you do so, please don't query for executable existence as it may slowdown vim startup on windows. It is quite slow there.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
and a function that checks if the provider is available
If you do so, please don't query for executable existence as it may slowdown vim startup on windows. It is quite slow there. I remember this was the issue with neovim back in a day I tried to use it on my windows box.
Thanks, I will take that into consideration
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
I think this is ready
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@h-east commented on this pull request.
In src/testdir/test_clipboard_provider.vim:
> + + " Check if texlock is working + call assert_fails("call setline(1, 'test')", "E565:") +endfunc + +" Test if 'paste' callback works properly +func Test_clipboard_provider_cb_paste() + new + let v:clipproviders["test"] = { + \ "available": {-> v:true}, + \ "paste": function("Paste") + \ } + set clipmethod=test + + if has('unnamedplus') + call assert_equal("reg: +", getreg('+'))
CI error has occurred.
From test_codestyle.vim:
Found errors in Test_test_files():
command line..script /home/runner/work/vim/vim/src/testdir/runtest.vim[636]..function RunTheTest[63]..Test_test_files[33]..<SNR>8_ReportError line 2: testdir/test_clipboard_provider.vim line 74: trailing white space
make[2]: *** [Makefile:187: opt_test.vim] Error 1
⬇️ Suggested change
- call assert_equal("reg: +", getreg('+')) + call assert_equal("reg: +", getreg('+'))
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@h-east commented on this pull request.
> Note: "other" is used on systems without X11/Wayland, such as MS-Windows or MacOS, when running Vim without the GUI. + Note that the name of the clipboard provider should be used when you + want to use a clipboard provider. See |clipboard-providers| for more⬇️ Suggested change
- want to use a clipboard provider. See |clipboard-providers| for more + want to use a clipboard provider. See |clipboard-providers| for more
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
can you please regenerate configure script on latest HEAD?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Turning this into a draft again for now because I've decided to go a different direction with the design
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 2 commits.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 0 commits.
You are receiving this because you are subscribed to this thread.
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.