Skip to content

Commit 5001480

Browse files
authored
Merge pull request #1442 from mityu/update-eval
Update eval.{txt,jax}
2 parents 637a281 + ef1cdcc commit 5001480

File tree

2 files changed

+101
-21
lines changed

2 files changed

+101
-21
lines changed

doc/eval.jax

+52-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*eval.txt* For Vim バージョン 9.1. Last change: 2024 Jan 14
1+
*eval.txt* For Vim バージョン 9.1. Last change: 2024 Feb 08
22

33

44
VIMリファレンスマニュアル by Bram Moolenaar
@@ -296,10 +296,15 @@ Note 関数の辞書へのバインドは、その関数が辞書のメンバー
296296
*list-concatenation*
297297
2つのリストを連結するには演算子 "+" を使う: >
298298
:let longlist = mylist + [5, 6]
299-
:let mylist += [7, 8]
299+
:let longlist = [5, 6] + mylist
300+
1個の要素を先頭または末尾に付け加えるには、[]で囲んでリストにして連結する。
300301

301-
1個の要素を先頭または末尾に付け加えるには、[]で囲んでリストにして連結する。リ
302-
ストの特定の要素を変更するには後述の|list-modification|を参照。
302+
リストは |:let+=| もしくは |extend()| を使うことで、他のリストとその場で連結す
303+
ることができる: >
304+
:let mylist += [7, 8]
305+
:call extend(mylist, [7, 8])
306+
<
307+
リストをその場で変更する他の方法については |list-modification| を参照。
303308

304309

305310
部分リスト ~
@@ -410,6 +415,19 @@ Note リストの比較について注意: 2つのリストは、同じ長さを
410415
とも削除する範囲の要素数と同じ数だけ必要である: >
411416
:let list[3:5] = [3, 4, 5]
412417
418+
リストに要素をその場で追加するには、|:let+=| (|list-concatenation|) を使うこと
419+
ができる: >
420+
:let listA = [1, 2]
421+
:let listA += [3, 4]
422+
<
423+
2 つのリストが同じリストを参照している時は、片方のリストをその場で変更すると、
424+
他方のリストもその場で変更される: >
425+
:let listA = [1, 2]
426+
:let listB = listA
427+
:let listB += [3, 4]
428+
:echo listA
429+
[1, 2, 3, 4]
430+
<
413431
リストに要素を追加したり削除するには関数を使う。いくつか例を示す: >
414432
:call insert(list, 'a') " 先頭に要素 'a' を挿入する
415433
:call insert(list, 'a', 3) " 要素 'a' をlist[3]の前に挿入する
@@ -722,12 +740,15 @@ Blobの繰り返し ~
722740

723741

724742
Blobの連結 ~
725-
743+
*blob-concatenation*
726744
2つのBlobは "+" 演算子で連結できる: >
727745
:let longblob = myblob + 0z4455
746+
:let longblob = 0z4455 + myblob
747+
<
748+
Blob は |:let+=| を使うことで、他の Blob とその場で連結することができる: >
728749
:let myblob += 0z6677
729-
730-
Blobの決まった場所を変更するには、下記の |blob-modification| を参照。
750+
<
751+
Blob をその場で変更する他の方法については、|blob-modification| を参照。
731752

732753

733754
Blobの一部 ~
@@ -769,6 +790,19 @@ Blobの一部を変更するには、変更する最初と最後のバイトを
769790
イト数は同じでなければならない: >
770791
:let blob[3:5] = 0z334455
771792
793+
Blob に要素をその場で追加するには、|:let+=| (|blob-concatenation|)を使うことが
794+
できる: >
795+
:let blobA = 0z1122
796+
:let blobA += 0z3344
797+
<
798+
2 つの Blob が同じ Blob を参照している時は、片方の Blob をその場で変更すると、
799+
他方の Blob もその場で変更される: >
800+
:let blobA = 0z1122
801+
:let blobB = blobA
802+
:let blobB += 0z3344
803+
:echo blobA
804+
0z11223344
805+
<
772806
関数 |add()|, |remove()| および |insert()| も使用できる。
773807

774808

@@ -1945,10 +1979,15 @@ v:collate 現在のロケール設定での実行環境の照合順序。これ
19451979
*v:colornames*
19461980
v:colornames カラー名を16進数カラー文字列に対応付ける辞書。これらのカラー名
19471981
は、|highlight-guifg|, |highlight-guibg|, |highlight-guisp|
1948-
パラメーターで使用できる。v:colornames のエントリを更新しても、
1949-
構文ハイライトにすぐに作用することはない。更新されたカラー値を
1950-
使用するには、highlight コマンド(おそらくカラースキームスクリ
1951-
プト内)を再評価する必要がある。例: >
1982+
パラメーターで使用できる。
1983+
1984+
Vim は色を小文字の色名で探すので、辞書のキーの値 (色名) は小文
1985+
字であるべきである。
1986+
1987+
v:colornames のエントリを更新しても、構文ハイライトにすぐに作
1988+
用することはない。更新されたカラー値を使用するには、highlight
1989+
コマンド(おそらくカラースキームスクリプト内)を再評価する必要が
1990+
ある。例: >
19521991
19531992
:let v:colornames['fuscia'] = '#cf3ab4'
19541993
:let v:colornames['mauve'] = '#915f6d'
@@ -2729,6 +2768,8 @@ Note: |Vim9| script では、`:let` は使用されない。`:var` は変数宣
27292768
:let {var} ..= {expr1} ":let {var} = {var} .. {expr1}" と同様。
27302769
{var}がセットされていないときや、{var}{expr1}の型が
27312770
演算子に合わないときは失敗する。
2771+
`+=` は新たなリスト |List||Blob| を作る代わりにそ
2772+
の場で変更する。
27322773
`.=` はVim scriptバージョン2以降ではサポートされていな
27332774
い。|vimscript-version| を参照。
27342775

en/eval.txt

+49-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*eval.txt* For Vim version 9.1. Last change: 2024 Jan 14
1+
*eval.txt* For Vim version 9.1. Last change: 2024 Feb 08
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -303,10 +303,15 @@ List concatenation ~
303303
*list-concatenation*
304304
Two lists can be concatenated with the "+" operator: >
305305
:let longlist = mylist + [5, 6]
306-
:let mylist += [7, 8]
306+
:let longlist = [5, 6] + mylist
307+
To prepend or append an item, turn it into a list by putting [] around it.
307308

308-
To prepend or append an item, turn the item into a list by putting [] around
309-
it. To change a list in-place, refer to |list-modification| below.
309+
A list can be concatenated with another one in-place using |:let+=| or
310+
|extend()|: >
311+
:let mylist += [7, 8]
312+
:call extend(mylist, [7, 8])
313+
<
314+
See |list-modification| below for more about changing a list in-place.
310315

311316

312317
Sublist ~
@@ -425,6 +430,18 @@ To change part of a list you can specify the first and last item to be
425430
modified. The value must at least have the number of items in the range: >
426431
:let list[3:5] = [3, 4, 5]
427432
433+
To add items to a List in-place, you can use |:let+=| (|list-concatenation|): >
434+
:let listA = [1, 2]
435+
:let listA += [3, 4]
436+
<
437+
When two variables refer to the same List, changing one List in-place will
438+
cause the referenced List to be changed in-place: >
439+
:let listA = [1, 2]
440+
:let listB = listA
441+
:let listB += [3, 4]
442+
:echo listA
443+
[1, 2, 3, 4]
444+
<
428445
Adding and removing items from a list is done with functions. Here are a few
429446
examples: >
430447
:call insert(list, 'a') " prepend item 'a'
@@ -745,12 +762,15 @@ This calls Doit() with 0x11, 0x22 and 0x33.
745762

746763

747764
Blob concatenation ~
748-
765+
*blob-concatenation*
749766
Two blobs can be concatenated with the "+" operator: >
750767
:let longblob = myblob + 0z4455
768+
:let longblob = 0z4455 + myblob
769+
<
770+
A blob can be concatenated with another one in-place using |:let+=|: >
751771
:let myblob += 0z6677
752-
753-
To change a blob in-place see |blob-modification| below.
772+
<
773+
See |blob-modification| below for more about changing a blob in-place.
754774

755775

756776
Part of a blob ~
@@ -793,6 +813,18 @@ To change part of a blob you can specify the first and last byte to be
793813
modified. The value must have the same number of bytes in the range: >
794814
:let blob[3:5] = 0z334455
795815
816+
To add items to a Blob in-place, you can use |:let+=| (|blob-concatenation|): >
817+
:let blobA = 0z1122
818+
:let blobA += 0z3344
819+
<
820+
When two variables refer to the same Blob, changing one Blob in-place will
821+
cause the referenced Blob to be changed in-place: >
822+
:let blobA = 0z1122
823+
:let blobB = blobA
824+
:let blobB += 0z3344
825+
:echo blobA
826+
0z11223344
827+
<
796828
You can also use the functions |add()|, |remove()| and |insert()|.
797829

798830

@@ -2005,9 +2037,14 @@ v:collate The current locale setting for collation order of the runtime
20052037
*v:colornames*
20062038
v:colornames A dictionary that maps color names to hex color strings. These
20072039
color names can be used with the |highlight-guifg|,
2008-
|highlight-guibg|, and |highlight-guisp| parameters. Updating
2009-
an entry in v:colornames has no immediate effect on the syntax
2010-
highlighting. The highlight commands (probably in a
2040+
|highlight-guibg|, and |highlight-guisp| parameters.
2041+
2042+
The key values in the dictionary (the color names) should be
2043+
lower cased, because Vim looks up a color by its lower case
2044+
name.
2045+
2046+
Updating an entry in v:colornames has no immediate effect on
2047+
the syntax highlighting. The highlight commands (probably in a
20112048
colorscheme script) need to be re-evaluated in order to use
20122049
the updated color values. For example: >
20132050
@@ -2804,6 +2841,8 @@ declarations and assignments do not use a command. |vim9-declaration|
28042841
:let {var} ..= {expr1} Like ":let {var} = {var} .. {expr1}".
28052842
These fail if {var} was not set yet and when the type
28062843
of {var} and {expr1} don't fit the operator.
2844+
`+=` modifies a |List| or a |Blob| in-place instead of
2845+
creating a new one.
28072846
`.=` is not supported with Vim script version 2 and
28082847
later, see |vimscript-version|.
28092848

0 commit comments

Comments
 (0)