Diff to HTML by rtfpessoa

Files changed (5) hide show
  1. runtime/doc/builtin.txt +2 -1
  2. runtime/doc/eval.txt +135 -1
  3. runtime/doc/options.txt +5 -0
  4. runtime/doc/various.txt +6 -2
  5. runtime/doc/version9.txt +19 -1
runtime/doc/builtin.txt CHANGED
@@ -1,4 +1,4 @@
1
- *builtin.txt* For Vim version 9.1. Last change: 2025 Oct 13
2
 
3
 
4
  VIM REFERENCE MANUAL by Bram Moolenaar
@@ -13061,6 +13061,7 @@ channel Compiled with support for |channel| and |job|
13061
  cindent Compiled with 'cindent' support. (always true)
13062
  clientserver Compiled with remote invocation support |clientserver|.
13063
  clipboard Compiled with 'clipboard' support.
 
13064
  clipboard_working Compiled with 'clipboard' support and it can be used.
13065
  cmdline_compl Compiled with |cmdline-completion| support.
13066
  cmdline_hist Compiled with |cmdline-history| support.
 
1
+ *builtin.txt* For Vim version 9.1. Last change: 2025 Oct 14
2
 
3
 
4
  VIM REFERENCE MANUAL by Bram Moolenaar
 
13061
  cindent Compiled with 'cindent' support. (always true)
13062
  clientserver Compiled with remote invocation support |clientserver|.
13063
  clipboard Compiled with 'clipboard' support.
13064
+ clipboard_provider Compiled with |clipboard-providers| support
13065
  clipboard_working Compiled with 'clipboard' support and it can be used.
13066
  cmdline_compl Compiled with |cmdline-completion| support.
13067
  cmdline_hist Compiled with |cmdline-history| support.
runtime/doc/eval.txt CHANGED
@@ -1,4 +1,4 @@
1
- *eval.txt* For Vim version 9.1. Last change: 2025 Oct 12
2
 
3
 
4
  VIM REFERENCE MANUAL by Bram Moolenaar
@@ -38,6 +38,7 @@ a remark is given.
38
  12. The sandbox |eval-sandbox|
39
  13. Textlock |textlock|
40
  14. Vim script library |vim-script-library|
 
41
 
42
  Testing support is documented in |testing.txt|.
43
  Profiling is documented at |profiling|.
@@ -2251,6 +2252,11 @@ v:clipmethod The current method of accessing the clipboard that is being
2251
  unavailable.
2252
  See 'clipmethod' for more details.
2253
 
 
 
 
 
 
2254
  *v:cmdarg* *cmdarg-variable*
2255
  v:cmdarg This variable is used for two purposes:
2256
  1. The extra arguments given to a file read/write command.
@@ -5263,5 +5269,133 @@ Usage: >vim
5263
  :call dist#vim9#Launch(<args>)
5264
  :Launch <app> <args>.
5265
  <
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5266
 
 
5267
  vim:tw=78:ts=8:noet:ft=help:norl:
 
1
+ *eval.txt* For Vim version 9.1. Last change: 2025 Oct 14
2
 
3
 
4
  VIM REFERENCE MANUAL by Bram Moolenaar
 
38
  12. The sandbox |eval-sandbox|
39
  13. Textlock |textlock|
40
  14. Vim script library |vim-script-library|
41
+ 15. Clipboard providers |clipboard-providers|
42
 
43
  Testing support is documented in |testing.txt|.
44
  Profiling is documented at |profiling|.
 
2252
  unavailable.
2253
  See 'clipmethod' for more details.
2254
 
2255
+ *v:clipproviders*
2256
+ v:clipproviders
2257
+ A dictionary containing clipboard providers, see
2258
+ |clipboard-providers| for more information.
2259
+
2260
  *v:cmdarg* *cmdarg-variable*
2261
  v:cmdarg This variable is used for two purposes:
2262
  1. The extra arguments given to a file read/write command.
 
5269
  :call dist#vim9#Launch(<args>)
5270
  :Launch <app> <args>.
5271
  <
5272
+ ==============================================================================
5273
+ 15. Clipboard providers *clipboard-providers*
5274
+
5275
+ When Vim is compiled with the |+clipboard_provider| feature, which requires
5276
+ the |+eval| feature, creating custom clipboards is possible. These providers
5277
+ handle the "+" and "*" registers. Note that on non-Unix or non-VMS systems,
5278
+ only the "*" register will be available for use.
5279
+
5280
+ To add a provider, add a new entry to the |v:clipproviders| dictionary, in the
5281
+ format of: >
5282
+ let v:clipproviders["name"] = {
5283
+ \ "available": function("Available"),
5284
+ \ "paste": {
5285
+ \ '+': function("Paste"), " For the + register
5286
+ \ '*': function("Paste"), " For the * register
5287
+ \ },
5288
+ \ "copy": {
5289
+ \ '+': function("Copy"), " Same thing as above
5290
+ \ '*': function("Copy"),
5291
+ \ },
5292
+ \ }
5293
+
5294
+ The key is the provider name, which should be used in 'clipmethod', for
5295
+ example in the following example, you would add "name" to 'clipmethod' in
5296
+ order to use it. >
5297
+ set clipmethod=name,wayland,x11,gui
5298
+
5299
+ Each callback can either be a name of a function in a string, a |Funcref|, or
5300
+ a |lambda| expression.
5301
+
5302
+ Note that these dictionary entries are optional, for example, if you don't
5303
+ care about the "copy" functions, then you can simply exclude them. When Vim
5304
+ yanks/copies something, then simply nothing will be done.
5305
+
5306
+ *clipboard-provider-available*
5307
+ The "available" callback should return a string, which should contain which
5308
+ clipboard registers are available. For example, if the "+" register is only
5309
+ available, then the function would return "+", or if both "+" and "*" are
5310
+ available, then return "+*".
5311
+
5312
+ *clipboard-provider-paste*
5313
+ The "paste" callback takes a first argument which is the register being put
5314
+ (string), and a second argument which is the type of access (string). It
5315
+ should return either a tuple/list or string. If a tuple/list is returned, it
5316
+ should have two elements:
5317
+ - The register type conforming to |setreg()|.
5318
+ - A list of strings
5319
+ If the register type is an empty string, then the type is automatically
5320
+ chosen, see |setreg()|. If a string is returned, then it can either be "clear"
5321
+ or "previous". "clear" makes Vim clear the register, and "previous" makes Vim
5322
+ use the previous register contents (or current depending on how you view it).
5323
+
5324
+ The second argument, the access type, can either be "explicit" or "implicit".
5325
+ "explicit" means that the user is directly accessing the clipboard, such as
5326
+ putting text, or calling |getreg()|; "implicit" means that the clipboard is
5327
+ being accessed indirectly, such when |:registers| is called, or when an
5328
+ unrelated operation causes Vim to access the clipboard.
5329
+
5330
+ This is useful since some operations in Vim implicity access the clipboard
5331
+ indirectly. For example, if when you want to create a provider for the OSC52
5332
+ command (accessing the clipboard via an escape code). Many terminals show a
5333
+ confirmation if you want Vim to access the clipboard. This can be very
5334
+ annoying with the terminal asking for permission everytime you do something
5335
+ that accesses the clipboard behind the scenes. A good way to handle implicit
5336
+ access is to return "previous", which leaves the register contents unchanged.
5337
+
5338
+ *clipboard-provider-copy*
5339
+ The "copy" callback returns nothing, and takes the given arguments in order:
5340
+ - The register being operated on
5341
+ - The register type, conforming to |getregtype()|
5342
+ - A list of strings to copy
5343
+
5344
+ The provider can do whatever it wants with the given information. This
5345
+ function is called on every request to change the clipboard register(s).
5346
+
5347
+ *clipboard-provider-textlock*
5348
+ In both the "paste" and "copy" callbacks, it is not allowed to change the
5349
+ buffer text, see |textlock|.
5350
+
5351
+ *clipboard-provider-example*
5352
+ Here is an example script that uses the clipboard provider feature through the
5353
+ OSC52 command: >vim
5354
+
5355
+ func Available()
5356
+ return "+"
5357
+ endfunc
5358
+
5359
+ func Paste(reg, type)
5360
+ " If implicit access, don't do anything
5361
+ if a:type == "implicit"
5362
+ return "previous"
5363
+ endif
5364
+
5365
+ augroup OSC
5366
+ autocmd!
5367
+ autocmd TermResponseAll osc ++once call feedkeys("\<F30>", '!')
5368
+ augroup END
5369
+
5370
+ " Send command
5371
+ call echoraw("\<Esc>]52;c;?\<Esc>\\")
5372
+
5373
+ " Wait until autocmd is triggered
5374
+ while getchar(-1) != "\<F30>"
5375
+ endwhile
5376
+
5377
+ autocmd! OSC
5378
+
5379
+ " Extract the base64 stuff
5380
+ let l:stuff = matchstr(v:termosc, '52;c;\zs[A-Za-z0-9+/=]\+')
5381
+
5382
+ return ("", blob2str(base64_decode(l:stuff)))
5383
+ endfunc
5384
+
5385
+ func Copy(reg, type, lines)
5386
+ call echoraw("\<Esc>]52;c;" ..
5387
+ \ base64_encode(str2blob(a:lines)) .. "\<Esc>\\")
5388
+ endfunc
5389
+ let v:clipproviders["myosc"] = {
5390
+ \ "available": function("Available"),
5391
+ \ "paste": {
5392
+ \ '+': function("Paste"),
5393
+ \ },
5394
+ \ "copy": {
5395
+ \ '+': function("Copy"),
5396
+ \ },
5397
+ \ }
5398
+ set clipmethod=myosc
5399
 
5400
+ <
5401
  vim:tw=78:ts=8:noet:ft=help:norl:
runtime/doc/options.txt CHANGED
@@ -1919,10 +1919,15 @@ A jump table for the options with a short description can be found at |Q_op|.
1919
  x11 X11 selections
1920
  gui GUI specific method
1921
  other Some other method
 
1922
 
1923
  Note: "other" is used on systems without X11/Wayland, such as
1924
  MS-Windows or MacOS, when running Vim without the GUI.
1925
 
 
 
 
 
1926
  The option value is a list of comma separated items. The list is
1927
  parsed left to right in order, and the first method that Vim
1928
  determines is available or is working is used as the actual method for
 
1919
  x11 X11 selections
1920
  gui GUI specific method
1921
  other Some other method
1922
+ * Clipboard provider method
1923
 
1924
  Note: "other" is used on systems without X11/Wayland, such as
1925
  MS-Windows or MacOS, when running Vim without the GUI.
1926
 
1927
+ Note that the name of the clipboard provider should be used when you
1928
+ want to use a clipboard provider. See |clipboard-providers| for more
1929
+ information.
1930
+
1931
  The option value is a list of comma separated items. The list is
1932
  parsed left to right in order, and the first method that Vim
1933
  determines is available or is working is used as the actual method for
runtime/doc/various.txt CHANGED
@@ -1,4 +1,4 @@
1
- *various.txt* For Vim version 9.1. Last change: 2025 Oct 12
2
 
3
 
4
  VIM REFERENCE MANUAL by Bram Moolenaar
@@ -378,6 +378,7 @@ m *+channel* inter process communication |channel|
378
  T *+cindent* 'cindent', C indenting; Always enabled
379
  N *+clientserver* Unix and Win32: Remote invocation |clientserver|
380
  *+clipboard* |clipboard| support compiled-in
 
381
  *+clipboard_working* |clipboard| support compiled-in and working
382
  T *+cmdline_compl* command line completion |cmdline-completion|
383
  T *+cmdline_hist* command line history |cmdline-history|
@@ -807,7 +808,10 @@ K Run a program to lookup the keyword under the
807
  :clip[reset] Attempts to choose a new method for accessing the
808
  clipboard, using the 'clipmethod' option. This is
809
  useful when the current method has become unavailable,
810
- and you want to try using another method.
 
 
 
811
  {only available when compiled with the |+clipboard|
812
  feature}
813
 
 
1
+ *various.txt* For Vim version 9.1. Last change: 2025 Oct 14
2
 
3
 
4
  VIM REFERENCE MANUAL by Bram Moolenaar
 
378
  T *+cindent* 'cindent', C indenting; Always enabled
379
  N *+clientserver* Unix and Win32: Remote invocation |clientserver|
380
  *+clipboard* |clipboard| support compiled-in
381
+ N *+clipboard_provider* |clipboard-providers| support compiled-in
382
  *+clipboard_working* |clipboard| support compiled-in and working
383
  T *+cmdline_compl* command line completion |cmdline-completion|
384
  T *+cmdline_hist* command line history |cmdline-history|
 
808
  :clip[reset] Attempts to choose a new method for accessing the
809
  clipboard, using the 'clipmethod' option. This is
810
  useful when the current method has become unavailable,
811
+ and you want to try using another method. If the
812
+ |+clipboard_provider| feature is being used, this
813
+ command should be called after the availability of one
814
+ of the clipboard registers changes.
815
  {only available when compiled with the |+clipboard|
816
  feature}
817
 
runtime/doc/version9.txt CHANGED
@@ -1,4 +1,4 @@
1
- *version9.txt* For Vim version 9.1. Last change: 2025 Oct 12
2
 
3
 
4
  VIM REFERENCE MANUAL by Bram Moolenaar
@@ -41653,6 +41653,8 @@ Other new features ~
41653
 
41654
  - |items()| function now supports Blob.
41655
 
 
 
41656
  *changed-9.2*
41657
  Changed~
41658
  -------
@@ -41900,13 +41902,29 @@ Options: ~
41900
  compositor
41901
 
41902
  Vim Variables: ~
 
 
 
 
 
 
 
41903
  |v:termda1| The escape sequence returned for the primary device
41904
  attribute query (DA1).
 
 
41905
 
41906
  Vim Arguments: ~
41907
  |-Y| Do not connect to the |wayland| compositor.
41908
  |--clientserver| Specify backend for clientserver functionality.
41909
 
 
 
 
 
 
 
 
41910
 
41911
  ==============================================================================
41912
  INCOMPATIBLE CHANGES *incompatible-9.2*
 
1
+ *version9.txt* For Vim version 9.1. Last change: 2025 Oct 14
2
 
3
 
4
  VIM REFERENCE MANUAL by Bram Moolenaar
 
41653
 
41654
  - |items()| function now supports Blob.
41655
 
41656
+ - |clipboard-providers| support.
41657
+
41658
  *changed-9.2*
41659
  Changed~
41660
  -------
 
41902
  compositor
41903
 
41904
  Vim Variables: ~
41905
+ |v:clipmethod| The current 'clipmethod'.
41906
+ |v:clipproviders| A dictionary containing clipboard providers
41907
+ information.
41908
+ |v:stacktrace| The most recent caught exception.
41909
+ |v:t_enumvalue| Value of |enumvalue|.
41910
+ |v:t_enum| Value of |enum| type.
41911
+ |v:t_tuple| Value of |Tuple| type.
41912
  |v:termda1| The escape sequence returned for the primary device
41913
  attribute query (DA1).
41914
+ |v:termosc| The most recent received OSC response.
41915
+ |v:wayland_display| The name of the Wayland display Vim is connected to.
41916
 
41917
  Vim Arguments: ~
41918
  |-Y| Do not connect to the |wayland| compositor.
41919
  |--clientserver| Specify backend for clientserver functionality.
41920
 
41921
+ Configure Switches: ~
41922
+ --with-wayland Enable the |wayland| feature.
41923
+ --enable-wayland-focus-steal Enable the |wayland-focus-steal| feature.
41924
+ --enable-socketserver Enable the |socketserver-clientserver|
41925
+ feature.
41926
+ --enable-clipboard-provider Enable the |clipboard-providers| feature.
41927
+
41928
 
41929
  ==============================================================================
41930
  INCOMPATIBLE CHANGES *incompatible-9.2*