CursorHoldI
CursorHoldI is an autocommand event in Vim and Neovim that fires while a user is in Insert mode after a period of inactivity. It is the Insert-mode counterpart to the CursorHold event, which triggers when the cursor is idle in Normal mode. Both events are tied to the updatetime setting and are commonly used to run lightweight actions during idle time, such as showing hints, performing background checks, or triggering integrations like language servers.
The timing for CursorHoldI is determined by the updatetime option. The default updatetime is typically 4000
Common uses include invoking functions or commands after a period of inactivity in Insert mode. For example,
- Vimscript: autocmd CursorHoldI * echom 'CursorHoldI fired in Insert mode'
- Neovim Lua: autocmd CursorHoldI * lua vim.lsp.buf.hover()
Notes: CursorHoldI relies on updatetime and may behave differently across Vim and Neovim builds. It is useful