1- *eval.txt* For Vim version 8.1. Last change: 2019 Apr 04
1+ *eval.txt* For Vim version 8.1. Last change: 2019 Apr 21
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1044,7 +1044,7 @@ expr7 * expr7 Number multiplication *expr-star*
10441044expr7 / expr7 Number division *expr-/*
10451045expr7 % expr7 Number modulo *expr-%*
10461046
1047- For all, except ".", Strings are converted to Numbers.
1047+ For all, except "." and ".." , Strings are converted to Numbers.
10481048For bitwise operators see | and() | , | or() | and | xor() | .
10491049
10501050Note the difference between "+" and ".":
@@ -1688,7 +1688,8 @@ v:count The count given for the last Normal mode command. Can be used
16881688 When there are two counts, as in "3d2w", they are multiplied,
16891689 just like what happens in the command, "d6w" for the example.
16901690 Also used for evaluating the 'formatexpr' option.
1691- "count" also works, for backwards compatibility.
1691+ "count" also works, for backwards compatibility, unless
1692+ | scriptversion | is 3 or higher.
16921693
16931694 *v:count1* *count1-variable*
16941695v:count1 Just like "v:count", but defaults to one when no count is
@@ -1720,7 +1721,8 @@ v:errmsg Last given error message. It's allowed to set this variable.
17201721 :silent! next
17211722 :if v:errmsg != ""
17221723 : ... handle error
1723- < "errmsg" also works, for backwards compatibility.
1724+ < "errmsg" also works, for backwards compatibility, unless
1725+ | scriptversion | is 3 or higher.
17241726
17251727 *v:errors* *errors-variable* *assert-return*
17261728v:errors Errors found by assert functions, such as | assert_true() | .
@@ -2023,7 +2025,8 @@ v:shell_error Result of the last shell command. When non-zero, the last
20232025 :if v:shell_error
20242026 : echo 'could not rename "foo" to "bar"!'
20252027 :endif
2026- < "shell_error" also works, for backwards compatibility.
2028+ < "shell_error" also works, for backwards compatibility, unless
2029+ | scriptversion | is 3 or higher.
20272030
20282031 *v:statusmsg* *statusmsg-variable*
20292032v:statusmsg Last given status message. It's allowed to set this variable.
@@ -2123,7 +2126,8 @@ v:testing Must be set before using `test_garbagecollect_now()`.
21232126v:this_session Full filename of the last loaded or saved session file. See
21242127 | :mksession | . It is allowed to set this variable. When no
21252128 session file has been saved, this variable is empty.
2126- "this_session" also works, for backwards compatibility.
2129+ "this_session" also works, for backwards compatibility, unless
2130+ | scriptversion | is 3 or higher
21272131
21282132 *v:throwpoint* *throwpoint-variable*
21292133v:throwpoint The point where the exception most recently caught and not
@@ -2154,7 +2158,7 @@ v:val Value of the current item of a |List| or |Dictionary|. Only
21542158v:version Version number of Vim: Major version number times 100 plus
21552159 minor version number. Version 5.0 is 500. Version 5.1 (5.01)
21562160 is 501. Read-only. "version" also works, for backwards
2157- compatibility.
2161+ compatibility, unless | scriptversion | is 3 or higher .
21582162 Use | has() | to check if a certain patch was included, e.g.: >
21592163 if has("patch-7.4.123")
21602164< Note that patch numbers are specific to the version, thus both
@@ -2508,9 +2512,7 @@ py3eval({expr}) any evaluate |python3| expression
25082512pyxeval({expr} ) any evaluate | python_x | expression
25092513range({expr} [, {max} [, {stride} ]])
25102514 List items from {expr} to {max}
2511- readdir({directory} [, {expr} ])
2512- List file names on {dir} with evalating
2513- {expr}
2515+ readdir({dir} [, {expr} ]) List file names in {dir} selected by {expr}
25142516readfile({fname} [, {type} [, {max} ]])
25152517 List get list of lines from file {fname}
25162518reg_executing() String get the executing register name
@@ -2677,7 +2679,7 @@ term_setkill({buf}, {how}) none set signal to stop job in terminal
26772679term_setrestore({buf} , {command} ) none set command to restore terminal
26782680term_setsize({buf} , {rows} , {cols} )
26792681 none set the size of a terminal
2680- term_start({cmd} , {options} ) Number open a terminal window and run a job
2682+ term_start({cmd} [ , {options} ] ) Number open a terminal window and run a job
26812683term_wait({buf} [, {time} ]) Number wait for screen to be updated
26822684test_alloc_fail({id} , {countdown} , {repeat} )
26832685 none make memory allocation fail
@@ -5398,6 +5400,9 @@ glob({expr} [, {nosuf} [, {list} [, {alllinks}]]]) *glob()*
53985400
53995401 If the expansion fails, the result is an empty String or List.
54005402
5403+ You can also use | readdir() | if you need to do complicated
5404+ things, such as limiting the number of matches.
5405+
54015406 A name for a non-existing file is not included. A symbolic
54025407 link is only included if it points to an existing file.
54035408 However, when the {alllinks} argument is present and it is
@@ -7279,6 +7284,8 @@ range({expr} [, {max} [, {stride}]]) *range()*
72797284 *readdir()*
72807285readdir({directory} [, {expr} ])
72817286 Return a list with file and directory names in {directory} .
7287+ You can also use | glob() | if you don't need to do complicated
7288+ things, such as limiting the number of matches.
72827289
72837290 When {expr} is omitted all entries are included.
72847291 When {expr} is given, it is evaluated to check what to do:
@@ -7344,7 +7351,7 @@ reg_executing() *reg_executing()*
73447351
73457352reg_recording() *reg_recording()*
73467353 Returns the single letter name of the register being recorded.
7347- Returns an empty string string when not recording. See | q | .
7354+ Returns an empty string when not recording. See | q | .
73487355
73497356reltime([{start} [, {end} ]]) *reltime()*
73507357 Return an item that represents a time value. The format of
@@ -9433,6 +9440,7 @@ term_getcursor({buf}) *term_getcursor()*
94339440 is not blinking.
94349441 "shape" 1 for a block cursor, 2 for underline and 3
94359442 for a vertical bar.
9443+ "color" color of the cursor, e.g. "green"
94369444
94379445 {buf} must be the buffer number of a terminal window. If the
94389446 buffer does not exist or is not a terminal window, an empty
@@ -9603,7 +9611,7 @@ term_setsize({buf}, {rows}, {cols}) *term_setsize()* *E955*
96039611 exist or is not a terminal window, an error is given.
96049612 {only available when compiled with the | +terminal | feature}
96059613
9606- term_start({cmd} , {options} ) *term_start()*
9614+ term_start({cmd} [ , {options} ]) *term_start()*
96079615 Open a terminal window and run {cmd} in it.
96089616
96099617 {cmd} can be a string or a List, like with | job_start() | . The
@@ -10195,17 +10203,30 @@ winline() The result is a Number, which is the screen line of the cursor
1019510203 *winnr()*
1019610204winnr([{arg} ]) The result is a Number, which is the number of the current
1019710205 window. The top window has number 1.
10198- When the optional argument is "$", the number of the
10199- last window is returned (the window count). >
10200- let window_count = winnr('$')
10201- < When the optional argument is "#", the number of the last
10202- accessed window is returned (where | CTRL-W_p | goes to).
10203- If there is no previous window or it is in another tab page 0
10204- is returned.
10206+
10207+ The optional argument {arg} supports the following values:
10208+ $ the number of the last window (the window
10209+ count).
10210+ # the number of the last accessed window (where
10211+ | CTRL-W_p | goes to). If there is no previous
10212+ window or it is in another tab page 0 is
10213+ returned.
10214+ {N} j the number of the N th window below the
10215+ current window (where | CTRL-W_j | goes to).
10216+ {N} k the number of the N th window above the current
10217+ window (where | CTRL-W_k | goes to).
10218+ {N} h the number of the N th window left of the
10219+ current window (where | CTRL-W_h | goes to).
10220+ {N} l the number of the N th window right of the
10221+ current window (where | CTRL-W_l | goes to).
1020510222 The number can be used with | CTRL-W_w | and ":wincmd w"
1020610223 | :wincmd | .
1020710224 Also see | tabpagewinnr() | and | win_getid() | .
10208-
10225+ Examples: >
10226+ let window_count = winnr('$')
10227+ let prev_window = winnr('#')
10228+ let wnum = winnr('3k')
10229+ <
1020910230 *winrestcmd()*
1021010231winrestcmd() Returns a sequence of | :resize | commands that should restore
1021110232 the current window sizes. Only works properly when no windows
@@ -10544,6 +10565,7 @@ vim_starting True while initial source'ing takes place. |startup|
1054410565viminfo Compiled with viminfo support.
1054510566vimscript-1 Compiled Vim script version 1 support
1054610567vimscript-2 Compiled Vim script version 2 support
10568+ vimscript-3 Compiled Vim script version 3 support
1054710569virtualedit Compiled with 'virtualedit' option. (always true)
1054810570visual Compiled with Visual mode. (always true)
1054910571visualextra Compiled with extra Visual mode commands. (always
@@ -12681,7 +12703,7 @@ code can be used: >
1268112703
1268212704==============================================================================
126831270510. Vim script versions *vimscript-version* *vimscript-versions*
12684-
12706+ *scriptversion*
1268512707Over time many features have been added to Vim script. This includes Ex
1268612708commands, functions, variable types, etc. Each individual feature can be
1268712709checked with the | has() | and | exists() | functions.
@@ -12702,9 +12724,14 @@ instead of failing in mysterious ways. >
1270212724< String concatenation with "." is not supported, use ".." instead.
1270312725 This avoids the ambiguity using "." for Dict member access and
1270412726 floating point numbers. Now ".5" means the number 0.5.
12705- Test for support with: >
12706- has('vimscript-2')
12727+ >
12728+ :scriptversion 3
12729+ < All | vim-variable | s must be prefixed by "v:". E.g. "version" doesn't
12730+ work as | v:version | anymore, it can be used as a normal variable.
12731+ Same for some obvious names as "count" and others.
1270712732
12733+ Test for support with: >
12734+ has('vimscript-3')
1270812735
1270912736==============================================================================
127101273711. No +eval feature *no-eval-feature*
0 commit comments