Skip to content

Commit 90c65fa

Browse files
authored
Merge pull request #2447 from h-east/update-eval
Update eval.{txt,jax}
2 parents b3c8462 + 495772a commit 90c65fa

2 files changed

Lines changed: 258 additions & 10 deletions

File tree

doc/eval.jax

Lines changed: 126 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*eval.txt* For Vim バージョン 9.1. Last change: 2025 Dec 01
1+
*eval.txt* For Vim バージョン 9.1. Last change: 2025 Dec 19
22

33

44
VIM リファレンスマニュアル by Bram Moolenaar
@@ -36,6 +36,7 @@ Note: 式の評価はコンパイル時に無効化できる。無効化され
3636
12. サンドボックス |eval-sandbox|
3737
13. テキストロック |textlock|
3838
14. Vim script ライブラリ |vim-script-library|
39+
15. クリップボードプロバイダ |clipboard-providers|
3940

4041
テストのサポートは |testing.txt| を参照。
4142
プロファイリングは |profiling| に記録されている。
@@ -1316,7 +1317,13 @@ NOTE: |Vim9| script では 'ignorecase' を使用しない。
13161317
たい場合は、|get()| を使用して関数名を取得すればよい: >
13171318
if get(Part1, 'name') == get(Part2, 'name')
13181319
" Part1 と Part2 は同じ関数を指している
1319-
< *E1037*
1320+
<
1321+
*E1437*
1322+
|Object| は、他の |Object| とのみ比較できる。比較には、"equal"、"not equal"、
1323+
"is" および "isnot" 演算子のみ使用できる |expr4||enum||Object| の一種で
1324+
あり、同じルールが適用される。
1325+
1326+
*E1037*
13201327
|List||Tuple||Dictionary||Blob| で "is" または "isnot" を使用すると、式
13211328
が同じ |List||Tuple||Dictionary||Blob| インスタンスを参照しているかどう
13221329
かがチェックされる。|List| または |Tuple| のコピーは、元の |List| または
@@ -2184,7 +2191,14 @@ v:clipmethod 現在使用されているクリップボードへのアクセス
21842191
wayland Wayland プロトコルが使用されている。
21852192
x11 X11 セレクションが使用されている。
21862193
none 上記メソッドが無効または使用できない。
2187-
詳細は 'clipmethod' を参照。
2194+
上記のリストにない値に設定されている場合、指定された名前のク
2195+
リップボードプロバイダがクリップボード機能に使用される。詳細は
2196+
'clipmethod' を参照。
2197+
2198+
*v:clipproviders*
2199+
v:clipproviders
2200+
クリップボードプロバイダを含む辞書。詳細については、
2201+
|clipboard-providers| を参照。
21882202

21892203
*v:cmdarg* *cmdarg-variable*
21902204
v:cmdarg 2つの目的のために使われる:
@@ -3714,7 +3728,7 @@ text...
37143728
ける方法については|:echo-redraw|を参照。
37153729

37163730
*:echow* *:echowin* *:echowindow*
3717-
:[N]echow[indow] {expr1} ..
3731+
:[N]echow[indow] {expr1} ...
37183732
|:echomsg| と同様だがメッセージポップアップウィンドウ
37193733
が使用可能であればそこにメッセージが表示される。これは
37203734
3秒間表示され |hit-enter| プロンプトを回避することを意
@@ -5109,5 +5123,113 @@ NOTE: <args> のエスケープはユーザーに任される
51095123
:call dist#vim9#Launch(<args>)
51105124
:Launch <app> <args>.
51115125
<
5126+
==============================================================================
5127+
15. クリップボードプロバイダ *clipboard-providers*
5128+
5129+
クリップボードプロバイダ機能を使用すると、"+" |quoteplus| および "*"
5130+
|quotestar| レジスタを、Vim Script のカスタム関数で上書きできる。プロバイダは
5131+
複数存在でき、Vim は 'clipmethod' に基づいて使用するプロバイダを選択する。
5132+
5133+
名前に反して、クリップボードの機能とは切り離して扱うべきである。実質的には、ク
5134+
リップボードのレジスタの既存の挙動を上書きする。
5135+
5136+
*clipboard-providers-clipboard*
5137+
クリップボードプロバイダ機能は、'clipboard' オプションの "unnamed" および
5138+
"unnamedplus" の値を尊重する。それ以外の値は無視される。
5139+
5140+
*clipboard-providers-no-clipboard*
5141+
|+clipboard| 機能が有効になっていない場合、|v:clipmethod| がプロバイダに設定さ
5142+
れていない限り、"+" および "*" レジスタは有効化/使用できない。プロバイダに設定
5143+
されている場合、|+clipboard| 機能がなくてもクリップボードレジスタは使用可能に
5144+
なる。
5145+
5146+
*clipboard-providers-plus*
5147+
"*" レジスタのみを持つプラットフォームでは、"+" レジスタは |v:clipmethod| がプ
5148+
ロバイダに設定されている場合にのみ使用できる。"+" レジスタが使用可能かどうかを
5149+
確認したい場合は、次のコマンドで確認できる: >
5150+
if has('unnamedplus')
5151+
<
5152+
*clipboard-providers-clipmethod*
5153+
Vim のクリップボード機能にプロバイダを統合するには、すべてのプラットフォームで
5154+
'clipmethod' オプションを使用する。このオプションにはクリップボードプロバイダ
5155+
の名前を指定し、Vim がこれを選択した場合は "+" および "*" レジスタを上書きす
5156+
る。Note "+" および "*" は viminfo には一切保存されないことに注意。
5157+
5158+
*clipboard-providers-define*
5159+
クリップボードプロバイダを定義するには、vim 変数 |v:clipproviders| を使用する。
5160+
これは |dict| で、各キーはクリップボードプロバイダ名、値は "available"、
5161+
"copy"、"paste" コールバックを宣言する別の |dict| である: >vim
5162+
let v:clipproviders["myprovider"] = {
5163+
\ "available": function("Available"),
5164+
\ "paste": {
5165+
\ "+": function("Paste"),
5166+
\ "*": function("Paste")
5167+
\ },
5168+
\ "copy": {
5169+
\ "+": function("Copy"),
5170+
\ "*": function("Copy")
5171+
\ }
5172+
\ }
5173+
set clipmethod^=myprovider
5174+
<
5175+
各コールバックは、文字列内の関数名、|Funcref|、または |lambda| 式のいずれかに
5176+
なる。
51125177

5178+
"available" コールバックを除き、コールバックが提供されていない場合は Vim は何
5179+
も呼び出さない。これはエラーではない。
5180+
5181+
*clipboard-providers-textlock*
5182+
"paste" および "copy" コールバックの両方で、バッファのテキストを変更することは
5183+
できない。|textlock| を参照。
5184+
5185+
*clipboard-providers-available*
5186+
"available" コールバックはオプションで、引数を取らず、|boolean| または非ゼロの
5187+
数値を返す必要がある。この数値は Vim にそのプロバイダが使用可能かどうかを通知
5188+
する。使用可能でない場合、Vim はその値をスキップし、次の 'clipmethod' 値を試
5189+
す。"available" コールバックが指定されていない場合、Vim はプロバイダが常に使用
5190+
可能 (true) であると想定する。
5191+
5192+
*clipboard-providers-paste*
5193+
"paste" コールバックは以下の引数を以下の順序で受け取る:
5194+
1. アクセスされるレジスタの名前。"+" または "*" のいずれかである。
5195+
5196+
以下の要素を順番に含む |list| または |tuple| を返す必要がある:
5197+
1. |setreg()| に準拠したレジスタの型 (およびオプションで幅) を指定す
5198+
る。空文字列の場合、型は自動的に選択される。
5199+
2. Vim に返される文字列の |list|。各文字列は行を表す。
5200+
5201+
*clipboard-providers-copy*
5202+
"copy" コールバックは何も返さず、以下の順序で以下の引数を受け取る:
5203+
1. アクセスされるレジスタの名前。"+" または "*" のいずれかである。
5204+
2. |getregtype()| に準拠したレジスタタイプ
5205+
3. 使用する文字列のリスト。各文字列は行を表す。
5206+
5207+
以下は、クリップボードプロバイダ機能を使用するサンプルスクリプトである: >vim
5208+
func Available()
5209+
return v:true
5210+
endfunc
5211+
5212+
func Copy(reg, type, str)
5213+
echom "Register: " .. a:reg
5214+
echom "Register type: " .. a:type
5215+
echom "Contents: " .. string(a:str)
5216+
endfunc
5217+
5218+
func Paste(reg)
5219+
return ("b40", ["this", "is", "the", a:reg, "register!"])
5220+
endfunc
5221+
5222+
let v:clipproviders["test"] = {
5223+
\ "available": function("Available"),
5224+
\ "copy": {
5225+
\ "+": function("Copy"),
5226+
\ "*": function("Copy")
5227+
\ },
5228+
\ "paste": {
5229+
\ "+": function("Paste"),
5230+
\ "*": function("Paste")
5231+
\ }
5232+
\ }
5233+
set clipmethod^=test
5234+
<
51135235
vim:tw=78:ts=8:noet:ft=help:norl:

en/eval.txt

Lines changed: 132 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*eval.txt* For Vim version 9.1. Last change: 2025 Dec 01
1+
*eval.txt* For Vim version 9.1. Last change: 2025 Dec 19
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -38,6 +38,7 @@ a remark is given.
3838
12. The sandbox |eval-sandbox|
3939
13. Textlock |textlock|
4040
14. Vim script library |vim-script-library|
41+
15. Clipboard providers |clipboard-providers|
4142

4243
Testing support is documented in |testing.txt|.
4344
Profiling is documented at |profiling|.
@@ -1348,7 +1349,13 @@ To compare Funcrefs to see if they refer to the same function, ignoring bound
13481349
Dictionary and arguments, use |get()| to get the function name: >
13491350
if get(Part1, 'name') == get(Part2, 'name')
13501351
" Part1 and Part2 refer to the same function
1351-
< *E1037*
1352+
<
1353+
*E1437*
1354+
An |Object| can only be compared with another |Object|, using only the
1355+
"equal", "not equal", "is" and "isnot" operators |expr4|. An |enum| is also a
1356+
type of |Object|, and the same rules apply.
1357+
1358+
*E1037*
13521359
Using "is" or "isnot" with a |List|, |Tuple|, |Dictionary| or |Blob| checks
13531360
whether the expressions are referring to the same |List|, |Tuple|,
13541361
|Dictionary| or |Blob| instance. A copy of a |List| or |Tuple| is different
@@ -2247,7 +2254,14 @@ v:clipmethod The current method of accessing the clipboard that is being
22472254
x11 X11 selections are being used.
22482255
none The above methods are unavailable or
22492256
cannot be used.
2250-
See 'clipmethod' for more details.
2257+
If it is set to a value not in the above list, then a
2258+
clipboard provider with the given name is being used for the
2259+
clipboard functionality. See 'clipmethod' for more details.
2260+
2261+
*v:clipproviders*
2262+
v:clipproviders
2263+
A dictionary containing clipboard providers, see
2264+
|clipboard-providers| for more information.
22512265

22522266
*v:cmdarg* *cmdarg-variable*
22532267
v:cmdarg This variable is used for two purposes:
@@ -2381,7 +2395,7 @@ v:echospace Number of screen cells that can be used for an `:echo` message
23812395
available above the last line.
23822396

23832397
*v:errmsg* *errmsg-variable*
2384-
v:errmsg Last error message that occurred (not neccessarily displayed).
2398+
v:errmsg Last error message that occurred (not necessarily displayed).
23852399
It's allowed to set this variable. Example: >
23862400
:let v:errmsg = ""
23872401
:silent! next
@@ -3833,7 +3847,7 @@ text...
38333847
when the screen is redrawn.
38343848

38353849
*:echow* *:echowin* *:echowindow*
3836-
:[N]echow[indow] {expr1} ..
3850+
:[N]echow[indow] {expr1} ...
38373851
Like |:echomsg| but when the messages popup window is
38383852
available the message is displayed there. This means
38393853
it will show for three seconds and avoid a
@@ -5266,5 +5280,117 @@ Usage: >vim
52665280
:call dist#vim9#Launch(<args>)
52675281
:Launch <app> <args>.
52685282
<
5269-
5283+
==============================================================================
5284+
15. Clipboard providers *clipboard-providers*
5285+
5286+
The clipboard provider feature allows the "+" |quoteplus| and "*" |quotestar|
5287+
registers to be overridden by custom Vim script functions. There can be
5288+
multiple providers, and Vim chooses which one to use based on 'clipmethod'.
5289+
5290+
Despite the name, it should be treated separate from the clipboard
5291+
functionality. It essentially overrides the existing behaviour of the
5292+
clipboard registers.
5293+
5294+
*clipboard-providers-clipboard*
5295+
The clipboard provider feature will respect the "unnamed" and "unnamedplus"
5296+
values in the 'clipboard' option. Any other value will be ignored.
5297+
5298+
*clipboard-providers-no-clipboard*
5299+
If the |+clipboard| feature is not enabled, then the "+" and "*" registers
5300+
will not be enabled/available unless |v:clipmethod| is set to a provider. If
5301+
it is set to a provider, then the clipboard registers will be exposed despite
5302+
not having the |+clipboard| feature.
5303+
5304+
*clipboard-providers-plus*
5305+
If on a platform that only has the "*" register, then the "+" register will
5306+
only be available when |v:clipmethod| is set to a provider. If you want to
5307+
check if the "+" is available for use, it can be checked with: >
5308+
if has('unnamedplus')
5309+
<
5310+
*clipboard-providers-clipmethod*
5311+
To integrate the providers with Vim's clipboard functionality, the
5312+
'clipmethod' option is used on all platforms. The names of clipboard
5313+
providers should be put inside the option, and if Vim chooses it, then it
5314+
overrides the "+" and "*" registers. Note that the "+" and "*" will not be
5315+
saved in the viminfo at all.
5316+
5317+
*clipboard-providers-define*
5318+
To define a clipboard provider, the |v:clipproviders| vim variable is used. It
5319+
is a |dict| where each key is the clipboard provider name, and the value is
5320+
another |dict| declaring the "available", "copy", and "paste" callbacks: >vim
5321+
let v:clipproviders["myprovider"] = {
5322+
\ "available": function("Available"),
5323+
\ "paste": {
5324+
\ "+": function("Paste"),
5325+
\ "*": function("Paste")
5326+
\ },
5327+
\ "copy": {
5328+
\ "+": function("Copy"),
5329+
\ "*": function("Copy")
5330+
\ }
5331+
\ }
5332+
set clipmethod^=myprovider
5333+
<
5334+
Each callback can either be a name of a function in a string, a |Funcref|, or
5335+
a |lambda| expression.
5336+
5337+
With the exception of the "available" callback if a callback is not provided,
5338+
Vim will not invoke anything, and this is not an error.
5339+
5340+
*clipboard-providers-textlock*
5341+
In both the "paste" and "copy" callbacks, it is not allowed to change the
5342+
buffer text, see |textlock|.
5343+
5344+
*clipboard-providers-available*
5345+
The "available" callback is optional, does not take any arguments and should
5346+
return a |boolean| or non-zero number, which tells Vim if it is available
5347+
for use. If it is not, then Vim skips over it and tries the next 'clipmethod'
5348+
value. If the "available" callback is not provided, Vim assumes the provider
5349+
is always available for use (true).
5350+
5351+
*clipboard-providers-paste*
5352+
The "paste" callback takes the following arguments in the following order:
5353+
1. Name of the register being accessed, either "+" or "*".
5354+
5355+
It should return a |list| or |tuple| containing the following elements in
5356+
order:
5357+
1. Register type (and optional width) conforming to |setreg()|. If it
5358+
is an empty string, then the type is automatically chosen.
5359+
2. A |list| of strings to return to Vim, each representing a line.
5360+
5361+
*clipboard-providers-copy*
5362+
The "copy" callback returns nothing and takes the following arguments in the
5363+
following order:
5364+
1. Name of the register being accessed, either "+" or "*".
5365+
2. Register type conforming to |getregtype()|
5366+
3. List of strings to use, each representing a line.
5367+
5368+
Below is a sample script that makes use of the clipboard provider feature: >vim
5369+
func Available()
5370+
return v:true
5371+
endfunc
5372+
5373+
func Copy(reg, type, str)
5374+
echom "Register: " .. a:reg
5375+
echom "Register type: " .. a:type
5376+
echom "Contents: " .. string(a:str)
5377+
endfunc
5378+
5379+
func Paste(reg)
5380+
return ("b40", ["this", "is", "the", a:reg, "register!"])
5381+
endfunc
5382+
5383+
let v:clipproviders["test"] = {
5384+
\ "available": function("Available"),
5385+
\ "copy": {
5386+
\ "+": function("Copy"),
5387+
\ "*": function("Copy")
5388+
\ },
5389+
\ "paste": {
5390+
\ "+": function("Paste"),
5391+
\ "*": function("Paste")
5392+
\ }
5393+
\ }
5394+
set clipmethod^=test
5395+
<
52705396
vim:tw=78:ts=8:noet:ft=help:norl:

0 commit comments

Comments
 (0)