comparison runtime/doc/eval.txt @ 23666:96206643bd9f

Update runtime files. Commit: https://github.com/vim/vim/commit/98a29d00a48e15a50e2850e1a29b7d475c531b0c Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jan 18 19:55:44 2021 +0100 Update runtime files.
author Bram Moolenaar <Bram@vim.org>
date Mon, 18 Jan 2021 20:00:09 +0100
parents 1816ea68c022
children cd06cc37f53f
comparison
equal deleted inserted replaced
23665:f22b9e522fb3 23666:96206643bd9f
1 *eval.txt* For Vim version 8.2. Last change: 2021 Jan 13 1 *eval.txt* For Vim version 8.2. Last change: 2021 Jan 17
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
4082 Note: on MS-Windows it is not possible to delete a directory 4082 Note: on MS-Windows it is not possible to delete a directory
4083 that is being used. 4083 that is being used.
4084 4084
4085 A symbolic link itself is deleted, not what it points to. 4085 A symbolic link itself is deleted, not what it points to.
4086 4086
4087 The result is a Number, which is 0 if the delete operation was 4087 The result is a Number, which is 0/false if the delete
4088 successful and -1 when the deletion failed or partly failed. 4088 operation was successful and -1/true when the deletion failed
4089 or partly failed.
4089 4090
4090 Use |remove()| to delete an item from a |List|. 4091 Use |remove()| to delete an item from a |List|.
4091 To delete a line from the buffer use |:delete| or 4092 To delete a line from the buffer use |:delete| or
4092 |deletebufline()|. 4093 |deletebufline()|.
4093 4094
6220 < If the `endif` would be moved to the second line as "| endif" it 6221 < If the `endif` would be moved to the second line as "| endif" it
6221 would not be found. 6222 would not be found.
6222 6223
6223 6224
6224 has_key({dict}, {key}) *has_key()* 6225 has_key({dict}, {key}) *has_key()*
6225 The result is a Number, which is 1 if |Dictionary| {dict} has 6226 The result is a Number, which is TRUE if |Dictionary| {dict}
6226 an entry with key {key}. Zero otherwise. 6227 has an entry with key {key}. FALSE otherwise.
6227 6228
6228 Can also be used as a |method|: > 6229 Can also be used as a |method|: >
6229 mydict->has_key(key) 6230 mydict->has_key(key)
6230 6231
6231 haslocaldir([{winnr} [, {tabnr}]]) *haslocaldir()* 6232 haslocaldir([{winnr} [, {tabnr}]]) *haslocaldir()*
6264 < 6265 <
6265 Can also be used as a |method|: > 6266 Can also be used as a |method|: >
6266 GetWinnr()->haslocaldir() 6267 GetWinnr()->haslocaldir()
6267 6268
6268 hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()* 6269 hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()*
6269 The result is a Number, which is 1 if there is a mapping that 6270 The result is a Number, which is TRUE if there is a mapping
6270 contains {what} in somewhere in the rhs (what it is mapped to) 6271 that contains {what} in somewhere in the rhs (what it is
6271 and this mapping exists in one of the modes indicated by 6272 mapped to) and this mapping exists in one of the modes
6272 {mode}. 6273 indicated by {mode}.
6273 When {abbr} is there and it is |TRUE| use abbreviations 6274 When {abbr} is there and it is |TRUE| use abbreviations
6274 instead of mappings. Don't forget to specify Insert and/or 6275 instead of mappings. Don't forget to specify Insert and/or
6275 Command-line mode. 6276 Command-line mode.
6276 Both the global mappings and the mappings local to the current 6277 Both the global mappings and the mappings local to the current
6277 buffer are checked for a match. 6278 buffer are checked for a match.
6278 If no matching mapping is found 0 is returned. 6279 If no matching mapping is found FALSE is returned.
6279 The following characters are recognized in {mode}: 6280 The following characters are recognized in {mode}:
6280 n Normal mode 6281 n Normal mode
6281 v Visual and Select mode 6282 v Visual and Select mode
6282 x Visual mode 6283 x Visual mode
6283 s Select mode 6284 s Select mode
6309 empty the current or last used history 6310 empty the current or last used history
6310 The {history} string does not need to be the whole name, one 6311 The {history} string does not need to be the whole name, one
6311 character is sufficient. 6312 character is sufficient.
6312 If {item} does already exist in the history, it will be 6313 If {item} does already exist in the history, it will be
6313 shifted to become the newest entry. 6314 shifted to become the newest entry.
6314 The result is a Number: 1 if the operation was successful, 6315 The result is a Number: TRUE if the operation was successful,
6315 otherwise 0 is returned. 6316 otherwise FALSE is returned.
6316 6317
6317 Example: > 6318 Example: >
6318 :call histadd("input", strftime("%Y %b %d")) 6319 :call histadd("input", strftime("%Y %b %d"))
6319 :let date=input("Enter date: ") 6320 :let date=input("Enter date: ")
6320 < This function is not available in the |sandbox|. 6321 < This function is not available in the |sandbox|.
6333 Upper/lowercase must match, unless "\c" is used |/\c|. 6334 Upper/lowercase must match, unless "\c" is used |/\c|.
6334 If {item} evaluates to a Number, it will be interpreted as 6335 If {item} evaluates to a Number, it will be interpreted as
6335 an index, see |:history-indexing|. The respective entry will 6336 an index, see |:history-indexing|. The respective entry will
6336 be removed if it exists. 6337 be removed if it exists.
6337 6338
6338 The result is a Number: 1 for a successful operation, 6339 The result is TRUE for a successful operation, otherwise FALSE
6339 otherwise 0 is returned. 6340 is returned.
6340 6341
6341 Examples: 6342 Examples:
6342 Clear expression register history: > 6343 Clear expression register history: >
6343 :call histdel("expr") 6344 :call histdel("expr")
6344 < 6345 <
6386 6387
6387 < Can also be used as a |method|: > 6388 < Can also be used as a |method|: >
6388 GetHistory()->histnr() 6389 GetHistory()->histnr()
6389 < 6390 <
6390 hlexists({name}) *hlexists()* 6391 hlexists({name}) *hlexists()*
6391 The result is a Number, which is non-zero if a highlight group 6392 The result is a Number, which is TRUE if a highlight group
6392 called {name} exists. This is when the group has been 6393 called {name} exists. This is when the group has been
6393 defined in some way. Not necessarily when highlighting has 6394 defined in some way. Not necessarily when highlighting has
6394 been defined for it, it may also have been used for a syntax 6395 been defined for it, it may also have been used for a syntax
6395 item. 6396 item.
6396 *highlight_exists()* 6397 *highlight_exists()*
6559 6560
6560 inputrestore() *inputrestore()* 6561 inputrestore() *inputrestore()*
6561 Restore typeahead that was saved with a previous |inputsave()|. 6562 Restore typeahead that was saved with a previous |inputsave()|.
6562 Should be called the same number of times inputsave() is 6563 Should be called the same number of times inputsave() is
6563 called. Calling it more often is harmless though. 6564 called. Calling it more often is harmless though.
6564 Returns 1 when there is nothing to restore, 0 otherwise. 6565 Returns TRUE when there is nothing to restore, FALSE otherwise.
6565 6566
6566 inputsave() *inputsave()* 6567 inputsave() *inputsave()*
6567 Preserve typeahead (also from mappings) and clear it, so that 6568 Preserve typeahead (also from mappings) and clear it, so that
6568 a following prompt gets input from the user. Should be 6569 a following prompt gets input from the user. Should be
6569 followed by a matching inputrestore() after the prompt. Can 6570 followed by a matching inputrestore() after the prompt. Can
6570 be used several times, in which case there must be just as 6571 be used several times, in which case there must be just as
6571 many inputrestore() calls. 6572 many inputrestore() calls.
6572 Returns 1 when out of memory, 0 otherwise. 6573 Returns TRUE when out of memory, FALSE otherwise.
6573 6574
6574 inputsecret({prompt} [, {text}]) *inputsecret()* 6575 inputsecret({prompt} [, {text}]) *inputsecret()*
6575 This function acts much like the |input()| function with but 6576 This function acts much like the |input()| function with but
6576 two exceptions: 6577 two exceptions:
6577 a) the user's response will be displayed as a sequence of 6578 a) the user's response will be displayed as a sequence of
7043 Can also be used as a |method|: > 7044 Can also be used as a |method|: >
7044 GetBuffer()->listener_flush() 7045 GetBuffer()->listener_flush()
7045 7046
7046 listener_remove({id}) *listener_remove()* 7047 listener_remove({id}) *listener_remove()*
7047 Remove a listener previously added with listener_add(). 7048 Remove a listener previously added with listener_add().
7048 Returns zero when {id} could not be found, one when {id} was 7049 Returns FALSE when {id} could not be found, TRUE when {id} was
7049 removed. 7050 removed.
7050 7051
7051 Can also be used as a |method|: > 7052 Can also be used as a |method|: >
7052 GetListenerId()->listener_remove() 7053 GetListenerId()->listener_remove()
7053 7054
7726 7727
7727 There is no error if the directory already exists and the "p" 7728 There is no error if the directory already exists and the "p"
7728 flag is passed (since patch 8.0.1708). However, without the 7729 flag is passed (since patch 8.0.1708). However, without the
7729 "p" option the call will fail. 7730 "p" option the call will fail.
7730 7731
7731 The function result is a Number, which is 1 if the call was 7732 The function result is a Number, which is TRUE if the call was
7732 successful or 0 if the directory creation failed or partly 7733 successful or FALSE if the directory creation failed or partly
7733 failed. 7734 failed.
7734 7735
7735 Not available on all systems. To check use: > 7736 Not available on all systems. To check use: >
7736 :if exists("*mkdir") 7737 :if exists("*mkdir")
7737 7738
9203 9204
9204 server2client({clientid}, {string}) *server2client()* 9205 server2client({clientid}, {string}) *server2client()*
9205 Send a reply string to {clientid}. The most recent {clientid} 9206 Send a reply string to {clientid}. The most recent {clientid}
9206 that sent a string can be retrieved with expand("<client>"). 9207 that sent a string can be retrieved with expand("<client>").
9207 {only available when compiled with the |+clientserver| feature} 9208 {only available when compiled with the |+clientserver| feature}
9209 Returns zero for success, -1 for failure.
9208 Note: 9210 Note:
9209 This id has to be stored before the next command can be 9211 This id has to be stored before the next command can be
9210 received. I.e. before returning from the received command and 9212 received. I.e. before returning from the received command and
9211 before calling any commands that waits for input. 9213 before calling any commands that waits for input.
9212 See also |clientserver|. 9214 See also |clientserver|.
9340 set after the command line is set to the expression. For 9342 set after the command line is set to the expression. For
9341 |c_CTRL-R_=| it is set after evaluating the expression but 9343 |c_CTRL-R_=| it is set after evaluating the expression but
9342 before inserting the resulting text. 9344 before inserting the resulting text.
9343 When the number is too big the cursor is put at the end of the 9345 When the number is too big the cursor is put at the end of the
9344 line. A number smaller than one has undefined results. 9346 line. A number smaller than one has undefined results.
9345 Returns 0 when successful, 1 when not editing the command 9347 Returns FALSE when successful, TRUE when not editing the
9346 line. 9348 command line.
9347 9349
9348 Can also be used as a |method|: > 9350 Can also be used as a |method|: >
9349 GetPos()->setcmdpos() 9351 GetPos()->setcmdpos()
9350 9352
9351 setcursorcharpos({lnum}, {col} [, {off}]) *setcursorcharpos()* 9353 setcursorcharpos({lnum}, {col} [, {off}]) *setcursorcharpos()*
9400 9402
9401 {lnum} is used like with |getline()|. 9403 {lnum} is used like with |getline()|.
9402 When {lnum} is just below the last line the {text} will be 9404 When {lnum} is just below the last line the {text} will be
9403 added below the last line. 9405 added below the last line.
9404 9406
9405 If this succeeds, 0 is returned. If this fails (most likely 9407 If this succeeds, FALSE is returned. If this fails (most likely
9406 because {lnum} is invalid) 1 is returned. 9408 because {lnum} is invalid) TRUE is returned.
9407 9409
9408 Example: > 9410 Example: >
9409 :call setline(5, strftime("%c")) 9411 :call setline(5, strftime("%c"))
9410 9412
9411 < When {text} is a |List| then line {lnum} and following lines 9413 < When {text} is a |List| then line {lnum} and following lines
11376 11378
11377 11379
11378 win_gotoid({expr}) *win_gotoid()* 11380 win_gotoid({expr}) *win_gotoid()*
11379 Go to window with ID {expr}. This may also change the current 11381 Go to window with ID {expr}. This may also change the current
11380 tabpage. 11382 tabpage.
11381 Return 1 if successful, 0 if the window cannot be found. 11383 Return TRUE if successful, FALSE if the window cannot be found.
11382 11384
11383 Can also be used as a |method|: > 11385 Can also be used as a |method|: >
11384 GetWinid()->win_gotoid() 11386 GetWinid()->win_gotoid()
11385 11387
11386 win_id2tabwin({expr}) *win_id2tabwin()* 11388 win_id2tabwin({expr}) *win_id2tabwin()*