1
- *eval.txt* For Vim version 8.1. Last change: 2019 Mar 02
1
+ *eval.txt* For Vim version 8.1. Last change: 2019 Mar 30
2
2
3
3
4
4
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -625,8 +625,11 @@ Functions that can be used with a Dictionary: >
625
625
626
626
1.5 Blobs ~
627
627
*blob* *Blob* *Blobs* *E978*
628
- A Blob mostly behaves like a | List | of numbers, where the numbers have an
629
- 8-bit value, from 0 to 255.
628
+ A Blob is a binary object. It can be used to read an image from a file and
629
+ send it over a channel, for example.
630
+
631
+ A Blob mostly behaves like a | List | of numbers, where each number has the
632
+ value of an 8-bit byte, from 0 to 255.
630
633
631
634
632
635
Blob creation ~
@@ -2262,11 +2265,12 @@ ch_status({handle} [, {options}])
2262
2265
changenr() Number current change number
2263
2266
char2nr({expr} [, {utf8} ]) Number ASCII/UTF8 value of first char in {expr}
2264
2267
cindent({lnum} ) Number C indent for line {lnum}
2265
- clearmatches() none clear all matches
2268
+ clearmatches([ {win} ]) none clear all matches
2266
2269
col({expr} ) Number column nr of cursor or mark
2267
2270
complete({startcol} , {matches} ) none set Insert mode completion
2268
2271
complete_add({expr} ) Number add completion match
2269
2272
complete_check() Number check for key typed during completion
2273
+ complete_info([{what} ]) Dict get current completion information
2270
2274
confirm({msg} [, {choices} [, {default} [, {type} ]]])
2271
2275
Number number of choice picked by user
2272
2276
copy({expr} ) any make a shallow copy of {expr}
@@ -2355,7 +2359,7 @@ getjumplist([{winnr} [, {tabnr}]])
2355
2359
getline({lnum} ) String line {lnum} of current buffer
2356
2360
getline({lnum} , {end} ) List lines {lnum} to {end} of current buffer
2357
2361
getloclist({nr} [, {what} ]) List list of location list items
2358
- getmatches() List list of current matches
2362
+ getmatches([ {win} ]) List list of current matches
2359
2363
getpid() Number process ID of Vim
2360
2364
getpos({expr} ) List position of cursor, mark, etc.
2361
2365
getqflist([{what} ]) List list of quickfix items
@@ -2446,7 +2450,7 @@ matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]])
2446
2450
matchaddpos({group} , {pos} [, {priority} [, {id} [, {dict} ]]])
2447
2451
Number highlight positions with {group}
2448
2452
matcharg({nr} ) List arguments of | :match |
2449
- matchdelete({id} ) Number delete match identified by {id}
2453
+ matchdelete({id} [, {win} ]) Number delete match identified by {id}
2450
2454
matchend({expr} , {pat} [, {start} [, {count} ]])
2451
2455
Number position where {pat} ends in {expr}
2452
2456
matchlist({expr} , {pat} [, {start} [, {count} ]])
@@ -2521,10 +2525,13 @@ repeat({expr}, {count}) String repeat {expr} {count} times
2521
2525
resolve({filename} ) String get filename a shortcut points to
2522
2526
reverse({list} ) List reverse {list} in-place
2523
2527
round({expr} ) Float round off {expr}
2528
+ rubyeval({expr} ) any evaluate | Ruby | expression
2524
2529
screenattr({row} , {col} ) Number attribute at screen position
2525
2530
screenchar({row} , {col} ) Number character at screen position
2531
+ screenchars({row} , {col} ) List List of characters at screen position
2526
2532
screencol() Number current cursor column
2527
2533
screenrow() Number current cursor row
2534
+ screenstring({row} , {col} ) String characters at screen position
2528
2535
search({pattern} [, {flags} [, {stopline} [, {timeout} ]]])
2529
2536
Number search for {pattern}
2530
2537
searchdecl({name} [, {global} [, {thisblock} ]])
@@ -2549,7 +2556,7 @@ setfperm({fname}, {mode}) Number set {fname} file permissions to {mode}
2549
2556
setline({lnum} , {line} ) Number set line {lnum} to {line}
2550
2557
setloclist({nr} , {list} [, {action} [, {what} ]])
2551
2558
Number modify location list using {list}
2552
- setmatches({list} ) Number restore a list of matches
2559
+ setmatches({list} [, {win} ]) Number restore a list of matches
2553
2560
setpos({expr} , {list} ) Number set the {expr} position to {list}
2554
2561
setqflist({list} [, {action} [, {what} ]])
2555
2562
Number modify quickfix list using {list}
@@ -2672,6 +2679,7 @@ test_null_partial() Funcref null value for testing
2672
2679
test_null_string() String null value for testing
2673
2680
test_option_not_set({name} ) none reset flag indicating option was set
2674
2681
test_override({expr} , {val} ) none test with Vim internal overrides
2682
+ test_refcount({expr} ) Number get the reference count of {expr}
2675
2683
test_scrollbar({which} , {value} , {dragging} )
2676
2684
none scroll in the GUI for testing
2677
2685
test_settime({expr} ) none set current time for testing
@@ -3439,6 +3447,10 @@ char2nr({expr} [, {utf8}]) *char2nr()*
3439
3447
< With {utf8} set to 1, always treat as utf-8 characters.
3440
3448
A combining character is a separate character.
3441
3449
| nr2char() | does the opposite.
3450
+ To turn a string into a list of character numbers: >
3451
+ let str = "ABC"
3452
+ let list = map(split(str, '\zs'), {_, val -> char2nr(val)})
3453
+ < Result: [65, 66, 67]
3442
3454
3443
3455
cindent({lnum} ) *cindent()*
3444
3456
Get the amount of indent for line {lnum} according the C
@@ -3449,9 +3461,11 @@ cindent({lnum}) *cindent()*
3449
3461
feature, -1 is returned.
3450
3462
See | C-indenting | .
3451
3463
3452
- clearmatches() *clearmatches()*
3453
- Clears all matches previously defined by | matchadd() | and the
3454
- | :match | commands.
3464
+ clearmatches([{win} ]) *clearmatches()*
3465
+ Clears all matches previously defined for the current window
3466
+ by | matchadd() | and the | :match | commands.
3467
+ If {win} is specified, use the window with this number or
3468
+ window ID instead of the current window.
3455
3469
3456
3470
*col()*
3457
3471
col({expr} ) The result is a Number, which is the byte index of the column
@@ -3536,6 +3550,55 @@ complete_check() *complete_check()*
3536
3550
Only to be used by the function specified with the
3537
3551
'completefunc' option.
3538
3552
3553
+ *complete_info()*
3554
+ complete_info([{what} ])
3555
+ Returns a Dictionary with information about Insert mode
3556
+ completion. See | ins-completion | .
3557
+ The items are:
3558
+ mode Current completion mode name string.
3559
+ See | completion_info_mode | for the values.
3560
+ pum_visible | TRUE | if popup menu is visible.
3561
+ See | pumvisible() | .
3562
+ items List of completion matches. Each item is a
3563
+ dictionary containing the entries "word",
3564
+ "abbr", "menu", "kind", "info" and "user_data".
3565
+ See | complete-items | .
3566
+ selected Selected item index. First index is zero.
3567
+ Index is -1 if no item is selected (showing
3568
+ typed text only)
3569
+ inserted Inserted string. [NOT IMPLEMENT YET]
3570
+
3571
+ *complete_info_mode*
3572
+ mode values are:
3573
+ "" Not in completion mode
3574
+ "keyword" Keyword completion | i_CTRL-X_CTRL-N |
3575
+ "ctrl_x" Just pressed CTRL-X | i_CTRL-X |
3576
+ "whole_line" Whole lines | i_CTRL-X_CTRL-L |
3577
+ "files" File names | i_CTRL-X_CTRL-F |
3578
+ "tags" Tags | i_CTRL-X_CTRL-] |
3579
+ "path_defines" Definition completion | i_CTRL-X_CTRL-D |
3580
+ "path_patterns" Include completion | i_CTRL-X_CTRL-I |
3581
+ "dictionary" Dictionary | i_CTRL-X_CTRL-K |
3582
+ "thesaurus" Thesaurus | i_CTRL-X_CTRL-T |
3583
+ "cmdline" Vim Command line | i_CTRL-X_CTRL-V |
3584
+ "function" User defined completion | i_CTRL-X_CTRL-U |
3585
+ "omni" Omni completion | i_CTRL-X_CTRL-O |
3586
+ "spell" Spelling suggestions | i_CTRL-X_s |
3587
+ "eval" | complete() | completion
3588
+ "unknown" Other internal modes
3589
+
3590
+ If the optional {what} list argument is supplied, then only
3591
+ the items listed in {what} are returned. Unsupported items in
3592
+ {what} are silently ignored.
3593
+
3594
+ Examples: >
3595
+ " Get all items
3596
+ call complete_info()
3597
+ " Get only 'mode'
3598
+ call complete_info(['mode'])
3599
+ " Get only 'mode' and 'pum_visible'
3600
+ call complete_info(['mode', 'pum_visible'])
3601
+ <
3539
3602
*confirm()*
3540
3603
confirm({msg} [, {choices} [, {default} [, {type} ]]])
3541
3604
confirm() offers the user a dialog, from which a choice can be
@@ -4975,11 +5038,12 @@ getloclist({nr} [, {what}]) *getloclist()*
4975
5038
| location-list-file-window | for more
4976
5039
details.
4977
5040
4978
- getmatches() *getmatches()*
4979
- Returns a | List | with all matches previously defined by
4980
- | matchadd() | and the | :match | commands. | getmatches() | is
4981
- useful in combination with | setmatches() | , as | setmatches() |
4982
- can restore a list of matches saved by | getmatches() | .
5041
+ getmatches([{win} ]) *getmatches()*
5042
+ Returns a | List | with all matches previously defined for the
5043
+ current window by | matchadd() | and the | :match | commands.
5044
+ | getmatches() | is useful in combination with | setmatches() | ,
5045
+ as | setmatches() | can restore a list of matches saved by
5046
+ | getmatches() | .
4983
5047
Example: >
4984
5048
:echo getmatches()
4985
5049
< [{'group' : 'MyGroup1', 'pattern' : 'TODO',
@@ -6344,7 +6408,7 @@ matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]])
6344
6408
Defines a pattern to be highlighted in the current window (a
6345
6409
"match"). It will be highlighted with {group} . Returns an
6346
6410
identification number (ID), which can be used to delete the
6347
- match using | matchdelete() | .
6411
+ match using | matchdelete() | . The ID is bound to the window.
6348
6412
Matching is case sensitive and magic, unless case sensitivity
6349
6413
or magicness are explicitly overridden in {pattern} . The
6350
6414
'magic' , 'smartcase' and 'ignorecase' options are not used.
@@ -6440,11 +6504,13 @@ matcharg({nr}) *matcharg()*
6440
6504
Highlighting matches using the | :match | commands are limited
6441
6505
to three matches. | matchadd() | does not have this limitation.
6442
6506
6443
- matchdelete({id} ) *matchdelete()* *E802* *E803*
6507
+ matchdelete({id} [, {win} ) *matchdelete()* *E802* *E803*
6444
6508
Deletes a match with ID {id} previously defined by | matchadd() |
6445
6509
or one of the | :match | commands. Returns 0 if successful,
6446
6510
otherwise -1. See example for | matchadd() | . All matches can
6447
6511
be deleted in one operation by | clearmatches() | .
6512
+ If {win} is specified, use the window with this number or
6513
+ window ID instead of the current window.
6448
6514
6449
6515
matchend({expr} , {pat} [, {start} [, {count} ]]) *matchend()*
6450
6516
Same as | match() | , but return the index of first character
@@ -6633,6 +6699,10 @@ nr2char({expr} [, {utf8}]) *nr2char()*
6633
6699
nr2char(10), because NULs are represented with newline
6634
6700
characters. nr2char(0) is a real NUL and terminates the
6635
6701
string, thus results in an empty string.
6702
+ To turn a list of character numbers into a string: >
6703
+ let list = [65, 66, 67]
6704
+ let str = join(map(list, {_, val -> nr2char(val)}), '')
6705
+ < Result: "ABC"
6636
6706
6637
6707
or({expr} , {expr} ) *or()*
6638
6708
Bitwise OR on the two arguments. The arguments are converted
@@ -7431,6 +7501,17 @@ round({expr}) *round()*
7431
7501
< -5.0
7432
7502
{only available when compiled with the | +float | feature}
7433
7503
7504
+ rubyeval({expr} ) *rubyeval()*
7505
+ Evaluate Ruby expression {expr} and return its result
7506
+ converted to Vim data structures.
7507
+ Numbers, floats and strings are returned as they are (strings
7508
+ are copied though).
7509
+ Arrays are represented as Vim | List | type.
7510
+ Hashes are represented as Vim | Dictionary | type.
7511
+ Other objects are represented as strings resulted from their
7512
+ "Object#to_s" method.
7513
+ {only available when compiled with the | +ruby | feature}
7514
+
7434
7515
screenattr({row} , {col} ) *screenattr()*
7435
7516
Like | screenchar() | , but return the attribute. This is a rather
7436
7517
arbitrary number that can only be used to compare to the
@@ -7446,6 +7527,13 @@ screenchar({row}, {col}) *screenchar()*
7446
7527
This is mainly to be used for testing.
7447
7528
Returns -1 when row or col is out of range.
7448
7529
7530
+ screenchars({row} , {col} ) *screenchars()*
7531
+ The result is a List of Numbers. The first number is the same
7532
+ as what | screenchar() | returns. Further numbers are
7533
+ composing characters on top of the base character.
7534
+ This is mainly to be used for testing.
7535
+ Returns an empty List when row or col is out of range.
7536
+
7449
7537
screencol() *screencol()*
7450
7538
The result is a Number, which is the current screen column of
7451
7539
the cursor. The leftmost column has number 1.
@@ -7467,6 +7555,14 @@ screenrow() *screenrow()*
7467
7555
7468
7556
Note: Same restrictions as with | screencol() | .
7469
7557
7558
+ screenstring({row} , {col} ) *screenstring()*
7559
+ The result is a String that contains the base character and
7560
+ any composing characters at position [row, col] on the screen.
7561
+ This is like | screenchars() | but returning a String with the
7562
+ characters.
7563
+ This is mainly to be used for testing.
7564
+ Returns an empty String when row or col is out of range.
7565
+
7470
7566
search({pattern} [, {flags} [, {stopline} [, {timeout} ]]]) *search()*
7471
7567
Search for regexp pattern {pattern} . The search starts at the
7472
7568
cursor position (you can use | cursor() | to set it).
@@ -7825,10 +7921,13 @@ setloclist({nr}, {list} [, {action} [, {what}]]) *setloclist()*
7825
7921
only the items listed in {what} are set. Refer to | setqflist() |
7826
7922
for the list of supported keys in {what} .
7827
7923
7828
- setmatches({list} ) *setmatches()*
7829
- Restores a list of matches saved by | getmatches() | . Returns 0
7830
- if successful, otherwise -1. All current matches are cleared
7831
- before the list is restored. See example for | getmatches() | .
7924
+ setmatches({list} [, {win} ]) *setmatches()*
7925
+ Restores a list of matches saved by |getmatches() for the
7926
+ current window|. Returns 0 if successful, otherwise -1. All
7927
+ current matches are cleared before the list is restored. See
7928
+ example for | getmatches() | .
7929
+ If {win} is specified, use the window with this number or
7930
+ window ID instead of the current window.
7832
7931
7833
7932
*setpos()*
7834
7933
setpos({expr} , {list} )
@@ -9589,6 +9688,11 @@ test_override({name}, {val}) *test_override()*
9589
9688
< The value of "starting" is saved. It is restored by: >
9590
9689
call test_override('starting', 0)
9591
9690
9691
+ test_refcount({expr} ) *test_refcount()*
9692
+ Return the reference count of {expr} . When {expr} is of a
9693
+ type that does not have a reference count, returns -1. Only
9694
+ to be used for testing.
9695
+
9592
9696
test_scrollbar({which} , {value} , {dragging} ) *test_scrollbar()*
9593
9697
Pretend using scrollbar {which} to move it to position
9594
9698
{value} . {which} can be:
@@ -10331,8 +10435,6 @@ tag_binary Compiled with binary searching in tags files
10331
10435
| tag-binary-search | .
10332
10436
tag_old_static Compiled with support for old static tags
10333
10437
| tag-old-static | .
10334
- tag_any_white Compiled with support for any white characters in tags
10335
- files | tag-any-white | .
10336
10438
tcl Compiled with Tcl interface.
10337
10439
termguicolors Compiled with true color in terminal support.
10338
10440
terminal Compiled with | terminal | support.
0 commit comments