|
1 | | -*eval.txt* For Vim version 8.2. Last change: 2020 Oct 23 |
| 1 | +*eval.txt* For Vim version 8.2. Last change: 2020 Nov 04 |
2 | 2 |
|
3 | 3 |
|
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -2681,8 +2681,9 @@ maparg({name} [, {mode} [, {abbr} [, {dict}]]]) |
2681 | 2681 | rhs of mapping {name} in mode {mode} |
2682 | 2682 | mapcheck({name} [, {mode} [, {abbr}]]) |
2683 | 2683 | String check for mappings matching {name} |
2684 | | -mapset({mode}, {abbr}, {dict}) |
2685 | | - none restore mapping from |maparg()| result |
| 2684 | +mapnew({expr1}, {expr2}) List/Dict like |map()| but creates a new List |
| 2685 | + or Dictionary |
| 2686 | +mapset({mode}, {abbr}, {dict}) none restore mapping from |maparg()| result |
2686 | 2687 | match({expr}, {pat} [, {start} [, {count}]]) |
2687 | 2688 | Number position where {pat} matches in {expr} |
2688 | 2689 | matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]]) |
@@ -3810,7 +3811,7 @@ confirm({msg} [, {choices} [, {default} [, {type}]]]) |
3810 | 3811 | not need to be the first letter: > |
3811 | 3812 | confirm("file has been modified", "&Save\nSave &All") |
3812 | 3813 | < For the console, the first letter of each choice is used as |
3813 | | - the default shortcut key. |
| 3814 | + the default shortcut key. Case is ignored. |
3814 | 3815 |
|
3815 | 3816 | The optional {default} argument is the number of the choice |
3816 | 3817 | that is made if the user hits <CR>. Use 1 to make the first |
@@ -4439,10 +4440,10 @@ extend({expr1}, {expr2} [, {expr3}]) *extend()* |
4439 | 4440 | |Dictionaries|. |
4440 | 4441 |
|
4441 | 4442 | If they are |Lists|: Append {expr2} to {expr1}. |
4442 | | - If {expr3} is given insert the items of {expr2} before item |
4443 | | - {expr3} in {expr1}. When {expr3} is zero insert before the |
4444 | | - first item. When {expr3} is equal to len({expr1}) then |
4445 | | - {expr2} is appended. |
| 4443 | + If {expr3} is given insert the items of {expr2} before the |
| 4444 | + item with index {expr3} in {expr1}. When {expr3} is zero |
| 4445 | + insert before the first item. When {expr3} is equal to |
| 4446 | + len({expr1}) then {expr2} is appended. |
4446 | 4447 | Examples: > |
4447 | 4448 | :echo sort(extend(mylist, [7, 5])) |
4448 | 4449 | :call extend(mylist, [2, 3], 1) |
@@ -6999,9 +7000,14 @@ luaeval({expr} [, {expr}]) *luaeval()* |
6999 | 7000 | < {only available when compiled with the |+lua| feature} |
7000 | 7001 |
|
7001 | 7002 | map({expr1}, {expr2}) *map()* |
7002 | | - {expr1} must be a |List| or a |Dictionary|. |
| 7003 | + {expr1} must be a |List|, |Blob| or |Dictionary|. |
7003 | 7004 | Replace each item in {expr1} with the result of evaluating |
7004 | | - {expr2}. {expr2} must be a |string| or |Funcref|. |
| 7005 | + {expr2}. For a |Blob| each byte is replaced. |
| 7006 | + If the item type changes you may want to use |mapnew()| to |
| 7007 | + create a new List or Dictionary. This is required when using |
| 7008 | + Vim9 script. |
| 7009 | + |
| 7010 | + {expr2} must be a |string| or |Funcref|. |
7005 | 7011 |
|
7006 | 7012 | If {expr2} is a |string|, inside {expr2} |v:val| has the value |
7007 | 7013 | of the current item. For a |Dictionary| |v:key| has the key |
@@ -7036,11 +7042,11 @@ map({expr1}, {expr2}) *map()* |
7036 | 7042 | |Dictionary| to remain unmodified make a copy first: > |
7037 | 7043 | :let tlist = map(copy(mylist), ' v:val . "\t"') |
7038 | 7044 |
|
7039 | | -< Returns {expr1}, the |List| or |Dictionary| that was filtered. |
7040 | | - When an error is encountered while evaluating {expr2} no |
7041 | | - further items in {expr1} are processed. When {expr2} is a |
7042 | | - Funcref errors inside a function are ignored, unless it was |
7043 | | - defined with the "abort" flag. |
| 7045 | +< Returns {expr1}, the |List|, |Blob| or |Dictionary| that was |
| 7046 | + filtered. When an error is encountered while evaluating |
| 7047 | + {expr2} no further items in {expr1} are processed. When |
| 7048 | + {expr2} is a Funcref errors inside a function are ignored, |
| 7049 | + unless it was defined with the "abort" flag. |
7044 | 7050 |
|
7045 | 7051 | Can also be used as a |method|: > |
7046 | 7052 | mylist->map(expr2) |
@@ -7149,7 +7155,13 @@ mapcheck({name} [, {mode} [, {abbr}]]) *mapcheck()* |
7149 | 7155 | GetKey()->mapcheck('n') |
7150 | 7156 |
|
7151 | 7157 |
|
7152 | | -mapset({mode}, {abbr}, {dict}) *mapset()* |
| 7158 | +mapnew({expr1}, {expr2}) *mapnew()* |
| 7159 | + Like |map()| but instead of replacing items in {expr1} a new |
| 7160 | + List or Dictionary is created and returned. {expr1} remains |
| 7161 | + unchanged. |
| 7162 | + |
| 7163 | + |
| 7164 | +mapset({mode}, {abbr}, {dict}) *mapset()* |
7153 | 7165 | Restore a mapping from a dictionary returned by |maparg()|. |
7154 | 7166 | {mode} and {abbr} should be the same as for the call to |
7155 | 7167 | |maparg()|. *E460* |
@@ -8331,15 +8343,18 @@ reg_recording() *reg_recording()* |
8331 | 8343 | Returns an empty string when not recording. See |q|. |
8332 | 8344 |
|
8333 | 8345 | reltime([{start} [, {end}]]) *reltime()* |
8334 | | - Return an item that represents a time value. The format of |
8335 | | - the item depends on the system. It can be passed to |
8336 | | - |reltimestr()| to convert it to a string or |reltimefloat()| |
8337 | | - to convert to a Float. |
8338 | | - Without an argument it returns the current time. |
| 8346 | + Return an item that represents a time value. The item is a |
| 8347 | + list with items that depend on the system. In Vim 9 script |
| 8348 | + list<any> can be used. |
| 8349 | + The item can be passed to |reltimestr()| to convert it to a |
| 8350 | + string or |reltimefloat()| to convert to a Float. |
| 8351 | + |
| 8352 | + Without an argument reltime() returns the current time. |
8339 | 8353 | With one argument is returns the time passed since the time |
8340 | 8354 | specified in the argument. |
8341 | 8355 | With two arguments it returns the time passed between {start} |
8342 | 8356 | and {end}. |
| 8357 | + |
8343 | 8358 | The {start} and {end} arguments must be values returned by |
8344 | 8359 | reltime(). |
8345 | 8360 |
|
@@ -9712,15 +9727,25 @@ sort({list} [, {func} [, {dict}]]) *sort()* *E702* |
9712 | 9727 | When {func} is given and it is '1' or 'i' then case is |
9713 | 9728 | ignored. |
9714 | 9729 |
|
9715 | | - When {func} is given and it is 'l' then the current locale |
9716 | | - is used for ordering. See `language collate` to check or set |
9717 | | - the locale used for ordering. For example, with "en_US.UTF8", |
9718 | | - Ö will be ordered after O and before P, whereas with the |
9719 | | - Swedish locale "sv_SE.UTF8", it will be after Z. |
9720 | | - Case is typically ignored by the locale. |
| 9730 | + When {func} is given and it is 'l' then the current collation |
| 9731 | + locale is used for ordering. Implementation details: strcoll() |
| 9732 | + is used to compare strings. See |:language| check or set the |
| 9733 | + collation locale. |v:collate| can also be used to check the |
| 9734 | + current locale. Sorting using the locale typically ignores |
| 9735 | + case. Example: > |
| 9736 | + " ö is sorted similarly to o with English locale. |
| 9737 | + :language collate en_US.UTF8 |
| 9738 | + :echo sort(['n', 'o', 'O', 'ö', 'p', 'z'], 'l') |
| 9739 | +< ['n', 'o', 'O', 'ö', 'p', 'z'] ~ |
| 9740 | +> |
| 9741 | + " ö is sorted after z with Swedish locale. |
| 9742 | + :language collate sv_SE.UTF8 |
| 9743 | + :echo sort(['n', 'o', 'O', 'ö', 'p', 'z'], 'l') |
| 9744 | +< ['n', 'o', 'O', 'p', 'z', 'ö'] ~ |
| 9745 | + This does not work properly on Mac. |
9721 | 9746 |
|
9722 | 9747 | When {func} is given and it is 'n' then all items will be |
9723 | | - sorted numerical (Implementation detail: This uses the |
| 9748 | + sorted numerical (Implementation detail: this uses the |
9724 | 9749 | strtod() function to parse numbers, Strings, Lists, Dicts and |
9725 | 9750 | Funcrefs will be considered as being 0). |
9726 | 9751 |
|
@@ -11607,7 +11632,7 @@ menu Compiled with support for |:menu|. |
11607 | 11632 | mksession Compiled with support for |:mksession|. |
11608 | 11633 | modify_fname Compiled with file name modifiers. |filename-modifiers| |
11609 | 11634 | (always true) |
11610 | | -mouse Compiled with support mouse. |
| 11635 | +mouse Compiled with support for mouse. |
11611 | 11636 | mouse_dec Compiled with support for Dec terminal mouse. |
11612 | 11637 | mouse_gpm Compiled with support for gpm (Linux console mouse) |
11613 | 11638 | mouse_gpm_enabled GPM mouse is working |
|
0 commit comments