|
1 | | -*eval.txt* For Vim version 8.1. Last change: 2019 Jan 21 |
| 1 | +*eval.txt* For Vim version 8.1. Last change: 2019 Jan 24 |
2 | 2 |
|
3 | 3 |
|
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -662,6 +662,16 @@ is not available it returns -1 or the default value you specify: > |
662 | 662 | :echo get(myblob, idx, 999) |
663 | 663 |
|
664 | 664 |
|
| 665 | +Blob iteration ~ |
| 666 | + |
| 667 | +The |:for| loop executes commands for each byte of a Blob. The loop variable is |
| 668 | +set to each byte in the Blob. Example: > |
| 669 | + :for byte in 0z112233 |
| 670 | + : call Doit(byte) |
| 671 | + :endfor |
| 672 | +This calls Doit() with 0x11, 0x22 and 0x33. |
| 673 | + |
| 674 | + |
665 | 675 | Blob concatenation ~ |
666 | 676 |
|
667 | 677 | Two blobs can be concatenated with the "+" operator: > |
@@ -793,8 +803,9 @@ Expression syntax summary, from least to most significant: |
793 | 803 | etc. As above, append ? for ignoring case, # for |
794 | 804 | matching case |
795 | 805 |
|
796 | | - expr5 is expr5 same |List| instance |
797 | | - expr5 isnot expr5 different |List| instance |
| 806 | + expr5 is expr5 same |List|, |Dictionary| or |Blob| instance |
| 807 | + expr5 isnot expr5 different |List|, |Dictionary| or |Blob| |
| 808 | + instance |
798 | 809 |
|
799 | 810 | |expr5| expr6 |
800 | 811 | expr6 + expr6 .. number addition, list or blob concatenation |
@@ -962,12 +973,12 @@ Dictionary and arguments, use |get()| to get the function name: > |
962 | 973 | if get(Part1, 'name') == get(Part2, 'name') |
963 | 974 | " Part1 and Part2 refer to the same function |
964 | 975 |
|
965 | | -When using "is" or "isnot" with a |List| or a |Dictionary| this checks if the |
966 | | -expressions are referring to the same |List| or |Dictionary| instance. A copy |
967 | | -of a |List| is different from the original |List|. When using "is" without |
968 | | -a |List| or a |Dictionary| it is equivalent to using "equal", using "isnot" |
969 | | -equivalent to using "not equal". Except that a different type means the |
970 | | -values are different: > |
| 976 | +Using "is" or "isnot" with a |List|, |Dictionary| or |Blob| checks whether |
| 977 | +the expressions are referring to the same |List|, |Dictionary| or |Blob| |
| 978 | +instance. A copy of a |List| is different from the original |List|. When |
| 979 | +using "is" without a |List|, |Dictionary| or |Blob|, it is equivalent to |
| 980 | +using "equal", using "isnot" equivalent to using "not equal". Except that |
| 981 | +a different type means the values are different: > |
971 | 982 | echo 4 == '4' |
972 | 983 | 1 |
973 | 984 | echo 4 is '4' |
@@ -1012,16 +1023,16 @@ can be matched like an ordinary character. Examples: |
1012 | 1023 |
|
1013 | 1024 | expr5 and expr6 *expr5* *expr6* |
1014 | 1025 | --------------- |
1015 | | -expr6 + expr6 .. Number addition or |List| concatenation *expr-+* |
1016 | | -expr6 - expr6 .. Number subtraction *expr--* |
1017 | | -expr6 . expr6 .. String concatenation *expr-.* |
| 1026 | +expr6 + expr6 Number addition, |List| or |Blob| concatenation *expr-+* |
| 1027 | +expr6 - expr6 Number subtraction *expr--* |
| 1028 | +expr6 . expr6 String concatenation *expr-.* |
1018 | 1029 |
|
1019 | 1030 | For |Lists| only "+" is possible and then both expr6 must be a list. The |
1020 | 1031 | result is a new list with the two lists Concatenated. |
1021 | 1032 |
|
1022 | | -expr7 * expr7 .. Number multiplication *expr-star* |
1023 | | -expr7 / expr7 .. Number division *expr-/* |
1024 | | -expr7 % expr7 .. Number modulo *expr-%* |
| 1033 | +expr7 * expr7 Number multiplication *expr-star* |
| 1034 | +expr7 / expr7 Number division *expr-/* |
| 1035 | +expr7 % expr7 Number modulo *expr-%* |
1025 | 1036 |
|
1026 | 1037 | For all, except ".", Strings are converted to Numbers. |
1027 | 1038 | For bitwise operators see |and()|, |or()| and |xor()|. |
@@ -4121,6 +4132,9 @@ feedkeys({string} [, {mode}]) *feedkeys()* |
4121 | 4132 | 't' Handle keys as if typed; otherwise they are handled as |
4122 | 4133 | if coming from a mapping. This matters for undo, |
4123 | 4134 | opening folds, etc. |
| 4135 | + 'L' Lowlevel input. Only works for Unix or when using the |
| 4136 | + GUI. Keys are used as if they were coming from the |
| 4137 | + terminal. Other flags are not used. *E980* |
4124 | 4138 | 'i' Insert the string instead of appending (see above). |
4125 | 4139 | 'x' Execute commands until typeahead is empty. This is |
4126 | 4140 | similar to using ":normal!". You can call feedkeys() |
@@ -5740,6 +5754,10 @@ job_start({command} [, {options}]) *job_start()* |
5740 | 5754 | |:!cmd| this does not wait for the job to finish. |
5741 | 5755 | To start a job in a terminal window see |term_start()|. |
5742 | 5756 |
|
| 5757 | + If the job fails to start then |job_status()| on the returned |
| 5758 | + Job object results in "fail" and none of the callbacks will be |
| 5759 | + invoked. |
| 5760 | + |
5743 | 5761 | {command} can be a String. This works best on MS-Windows. On |
5744 | 5762 | Unix it is split up in white-separated parts to be passed to |
5745 | 5763 | execvp(). Arguments in double quotes can contain white space. |
@@ -11044,28 +11062,34 @@ This does NOT work: > |
11044 | 11062 | NOTE: The ":append" and ":insert" commands don't work |
11045 | 11063 | properly inside a ":while" and ":for" loop. |
11046 | 11064 |
|
11047 | | -:for {var} in {list} *:for* *E690* *E732* |
| 11065 | +:for {var} in {object} *:for* *E690* *E732* |
11048 | 11066 | :endfo[r] *:endfo* *:endfor* |
11049 | 11067 | Repeat the commands between ":for" and ":endfor" for |
11050 | | - each item in {list}. Variable {var} is set to the |
11051 | | - value of each item. |
11052 | | - When an error is detected for a command inside the |
11053 | | - loop, execution continues after the "endfor". |
11054 | | - Changing {list} inside the loop affects what items are |
11055 | | - used. Make a copy if this is unwanted: > |
| 11068 | + each item in {object}. {object} can be a |List| or |
| 11069 | + a |Blob|. Variable {var} is set to the value of each |
| 11070 | + item. When an error is detected for a command inside |
| 11071 | + the loop, execution continues after the "endfor". |
| 11072 | + Changing {object} inside the loop affects what items |
| 11073 | + are used. Make a copy if this is unwanted: > |
11056 | 11074 | :for item in copy(mylist) |
11057 | | -< When not making a copy, Vim stores a reference to the |
11058 | | - next item in the list, before executing the commands |
11059 | | - with the current item. Thus the current item can be |
11060 | | - removed without effect. Removing any later item means |
11061 | | - it will not be found. Thus the following example |
11062 | | - works (an inefficient way to make a list empty): > |
| 11075 | +< |
| 11076 | + When {object} is a |List| and not making a copy, Vim |
| 11077 | + stores a reference to the next item in the |List| |
| 11078 | + before executing the commands with the current item. |
| 11079 | + Thus the current item can be removed without effect. |
| 11080 | + Removing any later item means it will not be found. |
| 11081 | + Thus the following example works (an inefficient way |
| 11082 | + to make a |List| empty): > |
11063 | 11083 | for item in mylist |
11064 | 11084 | call remove(mylist, 0) |
11065 | 11085 | endfor |
11066 | | -< Note that reordering the list (e.g., with sort() or |
| 11086 | +< Note that reordering the |List| (e.g., with sort() or |
11067 | 11087 | reverse()) may have unexpected effects. |
11068 | 11088 |
|
| 11089 | + When {object} is a |Blob|, Vim always makes a copy to |
| 11090 | + iterate over. Unlike with |List|, modifying the |
| 11091 | + |Blob| does not affect the iteration. |
| 11092 | + |
11069 | 11093 | :for [{var1}, {var2}, ...] in {listlist} |
11070 | 11094 | :endfo[r] |
11071 | 11095 | Like ":for" above, but each item in {listlist} must be |
|
0 commit comments