|
1 | | -*builtin.txt* For Vim version 9.1. Last change: 2025 Sep 18 |
| 1 | +*builtin.txt* For Vim version 9.1. Last change: 2025 Oct 01 |
2 | 2 |
|
3 | 3 |
|
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -369,7 +369,7 @@ lispindent({lnum}) Number Lisp indent for line {lnum} |
369 | 369 | list2blob({list}) Blob turn {list} of numbers into a Blob |
370 | 370 | list2str({list} [, {utf8}]) String turn {list} of numbers into a String |
371 | 371 | list2tuple({list}) Tuple turn {list} of items into a tuple |
372 | | -listener_add({callback} [, {buf}]) |
| 372 | +listener_add({callback} [, {buf} [, {unbuffered}]]) |
373 | 373 | Number add a callback to listen to changes |
374 | 374 | listener_flush([{buf}]) none invoke listener callbacks |
375 | 375 | listener_remove({id}) none remove a listener callback |
@@ -451,8 +451,9 @@ popup_setbuf({id}, {buf}) Bool set the buffer for the popup window {id} |
451 | 451 | popup_setoptions({id}, {options}) |
452 | 452 | none set options for popup window {id} |
453 | 453 | popup_settext({id}, {text}) none set the text of popup window {id} |
454 | | -popup_show({id}) none unhide popup window {id} |
| 454 | +popup_show({id}) Number unhide popup window {id} |
455 | 455 | pow({x}, {y}) Float {x} to the power of {y} |
| 456 | +preinserted() Number whether text is inserted after cursor |
456 | 457 | prevnonblank({lnum}) Number line nr of non-blank line <= {lnum} |
457 | 458 | printf({fmt}, {expr1}...) String format text |
458 | 459 | prompt_getprompt({buf}) String get prompt text |
@@ -1939,7 +1940,7 @@ complete({startcol}, {matches}) *complete()* *E785* |
1939 | 1940 | func ListMonths() |
1940 | 1941 | call complete(col('.'), ['January', 'February', 'March', |
1941 | 1942 | \ 'April', 'May', 'June', 'July', 'August', |
1942 | | - \ 'September', \ 'October', 'November', 'December']) |
| 1943 | + \ 'September', 'October', 'November', 'December']) |
1943 | 1944 | return '' |
1944 | 1945 | endfunc |
1945 | 1946 | < |
@@ -3008,6 +3009,9 @@ expand({string} [, {nosuf} [, {list}]]) *expand()* |
3008 | 3009 | :r root (one extension removed) |
3009 | 3010 | :e extension only |
3010 | 3011 |
|
| 3012 | + More modifiers are supported, for the full list see |
| 3013 | + |filename-modifiers|. |
| 3014 | + |
3011 | 3015 | Example: > |
3012 | 3016 | :let &tags = expand("%:p:h") .. "/tags" |
3013 | 3017 | < Note that when expanding a string that starts with '%', '#' or |
@@ -5338,14 +5342,17 @@ gettext({text} [, {package}]) *gettext()* |
5338 | 5342 |
|
5339 | 5343 |
|
5340 | 5344 | getwininfo([{winid}]) *getwininfo()* |
5341 | | - Returns information about windows as a |List| with Dictionaries. |
| 5345 | + Returns information about windows as a |List| with |
| 5346 | + Dictionaries. |
5342 | 5347 |
|
5343 | | - If {winid} is given Information about the window with that ID |
5344 | | - is returned, as a |List| with one item. If the window does not |
5345 | | - exist the result is an empty list. |
| 5348 | + If {winid} is given, information about the window with that ID |
| 5349 | + is returned, as a |List| with one item. When that window is a |
| 5350 | + |popup| window, information about that popup window is |
| 5351 | + returned. If the window does not exist the result is an empty |
| 5352 | + list. |
5346 | 5353 |
|
5347 | 5354 | Without {winid} information about all the windows in all the |
5348 | | - tab pages is returned. |
| 5355 | + tab pages (excluding |popup|s) is returned. |
5349 | 5356 |
|
5350 | 5357 | Each List item is a |Dictionary| with the following entries: |
5351 | 5358 | botline last complete displayed buffer line |
@@ -6715,14 +6722,19 @@ list2tuple({list}) *list2tuple()* |
6715 | 6722 | Return type: tuple<{type}> (depending on the given |List|) |
6716 | 6723 |
|
6717 | 6724 |
|
6718 | | -listener_add({callback} [, {buf}]) *listener_add()* |
| 6725 | +listener_add({callback} [, {buf} [, {unbuffered}]]) *listener_add()* |
6719 | 6726 | Add a callback function that will be invoked when changes have |
6720 | 6727 | been made to buffer {buf}. |
6721 | 6728 | {buf} refers to a buffer name or number. For the accepted |
6722 | 6729 | values, see |bufname()|. When {buf} is omitted the current |
6723 | 6730 | buffer is used. |
6724 | 6731 | Returns a unique ID that can be passed to |listener_remove()|. |
6725 | 6732 |
|
| 6733 | + If the {buf} already has registered callbacks then the |
| 6734 | + equivalent of > |
| 6735 | + listener_flush({buf}) |
| 6736 | +< is performed before the new callback is added. |
| 6737 | + |
6726 | 6738 | The {callback} is invoked with five arguments: |
6727 | 6739 | bufnr the buffer that was changed |
6728 | 6740 | start first changed line number |
@@ -6765,20 +6777,37 @@ listener_add({callback} [, {buf}]) *listener_add()* |
6765 | 6777 | added 0 |
6766 | 6778 | col first column with a change or 1 |
6767 | 6779 |
|
| 6780 | + When {unbuffered} is |FALSE| or not provided the {callback} is |
| 6781 | + invoked: |
| 6782 | + |
| 6783 | + 1. Just before the screen is updated. |
| 6784 | + 2. When |listener_flush()| is called. |
| 6785 | + 3. When a change is being made that changes the line count in |
| 6786 | + a way that causes a line number in the list of changes to |
| 6787 | + become invalid. |
| 6788 | + |
6768 | 6789 | The entries are in the order the changes were made, thus the |
6769 | | - most recent change is at the end. The line numbers are valid |
6770 | | - when the callback is invoked, but later changes may make them |
6771 | | - invalid, thus keeping a copy for later might not work. |
| 6790 | + most recent change is at the end. |
| 6791 | + |
| 6792 | + Because of the third trigger reason for triggering a callback |
| 6793 | + listed above, the line numbers passed to the callback are not |
| 6794 | + guaranteed to be valid. If this is a problem then make |
| 6795 | + {unbuffered} |TRUE|. |
6772 | 6796 |
|
6773 | | - The {callback} is invoked just before the screen is updated, |
6774 | | - when |listener_flush()| is called or when a change is being |
6775 | | - made that changes the line count in a way it causes a line |
6776 | | - number in the list of changes to become invalid. |
| 6797 | + When {unbuffered} is |TRUE| the {callback} is invoked for every |
| 6798 | + single change. The changes list only holds a single dictionary |
| 6799 | + and the "start", "end" and "added" values in the dictionary are |
| 6800 | + the same as the corresponding callback arguments. The line |
| 6801 | + numbers are valid when the callback is invoked, but later |
| 6802 | + changes may make them invalid, thus keeping a copy for later |
| 6803 | + might not work. |
6777 | 6804 |
|
6778 | 6805 | The {callback} is invoked with the text locked, see |
6779 | 6806 | |textlock|. If you do need to make changes to the buffer, use |
6780 | 6807 | a timer to do this later |timer_start()|. |
6781 | 6808 |
|
| 6809 | + You may not call listener_add() during the {callback}. *E1569* |
| 6810 | + |
6782 | 6811 | The {callback} is not invoked when the buffer is first loaded. |
6783 | 6812 | Use the |BufReadPost| autocmd event to handle the initial text |
6784 | 6813 | of a buffer. |
@@ -8008,6 +8037,15 @@ pow({x}, {y}) *pow()* |
8008 | 8037 | Return type: |Number| |
8009 | 8038 |
|
8010 | 8039 |
|
| 8040 | +preinserted() *preinserted()* |
| 8041 | + Returns non-zero if text has been inserted after the cursor |
| 8042 | + because "preinsert" is present in 'completeopt', or because |
| 8043 | + "longest" is present in 'completeopt' while 'autocomplete' |
| 8044 | + is active. Otherwise returns zero. |
| 8045 | + |
| 8046 | + Return type: |Number| |
| 8047 | + |
| 8048 | + |
8011 | 8049 | prevnonblank({lnum}) *prevnonblank()* |
8012 | 8050 | Return the line number of the first line at or above {lnum} |
8013 | 8051 | that is not blank. Example: > |
@@ -12308,9 +12346,9 @@ values({dict}) *values()* |
12308 | 12346 |
|
12309 | 12347 | virtcol({expr} [, {list} [, {winid}]]) *virtcol()* |
12310 | 12348 | The result is a Number, which is the screen column of the file |
12311 | | - position given with {expr}. That is, the last screen position |
12312 | | - occupied by the character at that position, when the screen |
12313 | | - would be of unlimited width. When there is a <Tab> at the |
| 12349 | + position given with {expr}. That is, the total number of |
| 12350 | + screen cells occupied by the part of the line until the end of |
| 12351 | + the character at that position. When there is a <Tab> at the |
12314 | 12352 | position, the returned Number will be the column at the end of |
12315 | 12353 | the <Tab>. For example, for a <Tab> in column 1, with 'ts' |
12316 | 12354 | set to 8, it returns 8. |conceal| is ignored. |
@@ -12639,7 +12677,7 @@ winbufnr({nr}) The result is a Number, which is the number of the buffer |
12639 | 12677 | window is returned. |
12640 | 12678 | When window {nr} doesn't exist, -1 is returned. |
12641 | 12679 | Example: > |
12642 | | - :echo "The file in the current window is " . bufname(winbufnr(0)) |
| 12680 | + :echo "The file in the current window is " .. bufname(winbufnr(0)) |
12643 | 12681 | < |
12644 | 12682 | Can also be used as a |method|: > |
12645 | 12683 | FindWindow()->winbufnr()->bufname() |
@@ -13172,7 +13210,9 @@ vreplace Compiled with |gR| and |gr| commands. (always true) |
13172 | 13210 | vtp Compiled for vcon support |+vtp| (check vcon to find |
13173 | 13211 | out if it works in the current console). |
13174 | 13212 | wayland Compiled with Wayland protocol support. |
13175 | | -wayland_clipboard Compiled with support for Wayland selections/clipboard |
| 13213 | +wayland_clipboard Compiled with support for Wayland clipboard. |
| 13214 | +wayland_focus_steal Compiled with support for Wayland clipboard focus |
| 13215 | + stealing. |
13176 | 13216 | wildignore Compiled with 'wildignore' option. |
13177 | 13217 | wildmenu Compiled with 'wildmenu' option. |
13178 | 13218 | win16 old version for MS-Windows 3.1 (always false) |
|
0 commit comments