Home

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,

Examples:

- 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

milliseconds
(4
seconds),
but
users
can
adjust
it
to
a
shorter
interval
to
get
faster
responses.
Lower
values
increase
the
frequency
of
idle-triggered
actions
and
can
impact
editor
responsiveness,
so
they
are
chosen
based
on
user
preference
and
performance
considerations.
one
might
display
inline
diagnostics,
fetch
or
refresh
contextual
information,
or
trigger
asynchronous
code
analysis.
Autocommands
for
CursorHoldI
are
often
paired
with
other
autocommands
or
lazy-loading
features
to
minimize
disruption
during
active
typing.
for
lightweight
idle-time
actions
but
should
be
used
judiciously
to
avoid
unnecessary
work
during
typing.
See
also
CursorHold
and
the
updatetime
option.