Per-buffer updatetime for CursorHold autocommands
0 reputation · 16 Feb 2024, 21:46 UTC
Vim exposes a single global updatetime in standard builds that determines how long the editor waits after the last keystroke before firing CursorHold and CursorHoldI autocommands. The goal is to apply a longer idle interval to large or noisy buffers while keeping a shorter interval for source buffers where diagnostics and previews should appear promptly.
Because updatetime has no buffer-local, window-local, or filetype-local variant, any change affects every buffer in the instance. It is uncertain whether toggling updatetime on buffer entry and exit can isolate this behavior without resetting pending idle timers or dropping CursorHold events. Terminal and GUI frontends may also process the idle interval differently.
- Can updatetime be scoped to individual buffers or filetypes without affecting other windows?
- Does changing updatetime on buffer entry and exit preserve pending idle state reliably?
- Are there frontend-specific differences that make per-buffer CursorHold timing inconsistent?