|
1 | | -*builtin.txt* For Vim version 9.1. Last change: 2025 Dec 11 |
| 1 | +*builtin.txt* For Vim version 9.1. Last change: 2025 Dec 13 |
2 | 2 |
|
3 | 3 |
|
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -493,6 +493,8 @@ readdirex({dir} [, {expr} [, {dict}]]) |
493 | 493 | List file info in {dir} selected by {expr} |
494 | 494 | readfile({fname} [, {type} [, {max}]]) |
495 | 495 | List get list of lines from file {fname} |
| 496 | +redraw_listener_add({opts}) Number add callbacks to listen for redraws |
| 497 | +redraw_listener_remove({id}) none remove a redraw listener |
496 | 498 | reduce({object}, {func} [, {initial}]) |
497 | 499 | any reduce {object} using {func} |
498 | 500 | reg_executing() String get the executing register name |
@@ -8785,6 +8787,48 @@ readfile({fname} [, {type} [, {max}]]) *readfile()* |
8785 | 8787 | Return type: list<string> or list<any> |
8786 | 8788 |
|
8787 | 8789 |
|
| 8790 | +redraw_listener_add({opts}) *redraw_listener_add()* |
| 8791 | + Add a listener that holds callback functions that will be |
| 8792 | + called at specific times in the redraw cycle. {opts} is a |
| 8793 | + dictionary that contain the callback functions to be defined. |
| 8794 | + At least one callback must be specified. *E1571* |
| 8795 | + Returns a unique ID that can be passed to |
| 8796 | + |redraw_listener_remove()|. |
| 8797 | + |
| 8798 | + {opts} may have the following entries: |
| 8799 | + |
| 8800 | + on_start Called first on each screen redraw. Takes no |
| 8801 | + arguments and returns nothing. |
| 8802 | + on_end Called at the end of each screen redraw. |
| 8803 | + Takes no arguments and returns nothing. |
| 8804 | + |
| 8805 | + A good use case for this function is with the |listener_add()| |
| 8806 | + callback with unbuffered set to TRUE. This allows you to |
| 8807 | + modify the state on buffer changes, and finally render that |
| 8808 | + state just before the next redraw, only if it has changed. |
| 8809 | + Attempting to render or redraw for every single buffer change |
| 8810 | + would be very inefficient. |
| 8811 | + |
| 8812 | + You may not call redraw_listener_add() during any of the |
| 8813 | + callbacks defined in {opts}. *E1570* |
| 8814 | + |
| 8815 | + Can also be used as a |method|: > |
| 8816 | + GetOpts()->redraw_listener_add() |
| 8817 | +< |
| 8818 | + Return type: |Number| |
| 8819 | + |
| 8820 | + |
| 8821 | +redraw_listener_remove({id}) *redraw_listener_remove()* |
| 8822 | + Remove a redraw listener previously added with |
| 8823 | + |redraw_listener_add()|. Returns FALSE when {id} could not be |
| 8824 | + found, TRUE when {id} was removed. |
| 8825 | + |
| 8826 | + Can also be used as a |method|: > |
| 8827 | + GetRedrawListenerId()->redraw_listener_remove() |
| 8828 | +< |
| 8829 | + Return type: |Number| |
| 8830 | + |
| 8831 | + |
8788 | 8832 | reduce({object}, {func} [, {initial}]) *reduce()* *E998* |
8789 | 8833 | {func} is called for every item in {object}, which can be a |
8790 | 8834 | |String|, |List|, |Tuple| or a |Blob|. {func} is called with |
|
0 commit comments