@@ -631,6 +631,54 @@ it).
631631The minimal height and width of a window is set with 'winminheight' and
632632'winminwidth' . These are hard values, a window will never become smaller.
633633
634+
635+ WinScrolled and WinResized autocommands ~
636+ *win-scrolled-resized*
637+ If you want to get notified of changes in window sizes, the | WinResized |
638+ autocommand event can be used.
639+ If you want to get notified of text in windows scrolling vertically or
640+ horizontally, the | WinScrolled | autocommand event can be used. This will also
641+ trigger in window size changes.
642+ *WinResized-event*
643+ The | WinResized | event is triggered after updating the display, several
644+ windows may have changed size then. A list of the IDs of windows that changed
645+ since last time is provided in the v:event.windows variable, for example:
646+ [1003, 1006]
647+ *WinScrolled-event*
648+ The | WinScrolled | event is triggered after | WinResized | , and also if a window
649+ was scrolled. That can be vertically (the text at the top of the window
650+ changed) or horizontally (when 'wrap' is off or when the first displayed part
651+ of the first line changes). Note that | WinScrolled | will trigger many more
652+ times than | WinResized | , it may slow down editing a bit.
653+
654+ The information provided by | WinScrolled | is a dictionary for each window that
655+ has changes, using the window ID as the key, and a total count of the changes
656+ with the key "all". Example value for | v:event | (| Vim9 | syntax):
657+ {
658+ all: {width: 0, height: 2, leftcol: 0, topline: 1, skipcol: 0},
659+ 1003: {width: 0, height: -1, leftcol: 0, topline: 0, skipcol: 0},
660+ 1006: {width: 0, height: 1, leftcol: 0, topline: 1, skipcol: 0},
661+ }
662+
663+ Note that the "all" entry has the absolute values of the individual windows
664+ accumulated.
665+
666+ If you need more information about what changed, or you want to "debounce" the
667+ events (not handle every event to avoid doing too much work), you may want to
668+ use the `winlayout ()` and `getwininfo ()` functions.
669+
670+ | WinScrolled | and | WinResized | do not trigger when the first autocommand is
671+ added, only after the first scroll or resize. They may trigger when switching
672+ to another tab page.
673+
674+ The commands executed are expected to not cause window size or scroll changes.
675+ If this happens anyway, the event will trigger again very soon. In other
676+ words: Just before triggering the event, the current sizes and scroll
677+ positions are stored and used to decide whether there was a change.
678+ *E1312*
679+ It is not allowed to change the window layout here (split, close or move
680+ windows).
681+
634682==============================================================================
6356837. Argument and buffer list commands *buffer-list*
636684
0 commit comments