vimtricks.wiki Concise Vim tricks, one at a time.

How do I make CursorHold events fire faster so plugins and diagnostics respond more quickly?

Answer

:set updatetime=300

Explanation

Vim's updatetime option controls two things: how quickly the swap file is written after you stop typing, and how many milliseconds of inactivity before the CursorHold autocommand event fires. The default is 4000ms (4 seconds), which is far too slow for modern workflows.

How it works

  • The CursorHold event fires when the cursor has been stationary for updatetime milliseconds in normal mode
  • Many plugins rely on this event to trigger delayed actions: git gutter signs, LSP hover documentation, diagnostic popups, and highlight-under-cursor effects
  • Lower values make these plugins feel snappier; 300ms is a widely used sweet spot
  • The swap file write delay is also affected, so lower values provide more frequent crash protection

Example

Add to your .vimrc or init.vim:

set updatetime=300

With the default 4000ms, hovering over a word takes 4 seconds before LSP shows documentation. After setting updatetime=300, the popup appears within a third of a second.

Tips

  • Check the current value with :set updatetime?
  • Values below ~100ms can cause performance issues; 250–500ms is the practical range
  • The CursorHoldI event fires the same way but in insert mode
  • If you use no plugins that depend on CursorHold, this setting still improves swap file safety

Next

How do I make Neovim restore the scroll position when navigating back through the jump list?