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

How do I see search results as I type the pattern?

Answer

:set incsearch

Explanation

The incsearch option enables incremental search, which highlights matches in real time as you type the search pattern. This provides immediate feedback on what your search will match.

How it works

  • With incsearch enabled, Vim highlights the first match as you type each character
  • The view scrolls to show the current match
  • Press <CR> to confirm or <Esc> to cancel

Example

With incsearch on, typing /func incrementally shows matches:

  • /f highlights the first f
  • /fu jumps to the first fu
  • /func jumps to the first func

Tips

  • This is enabled by default in most Vim configurations
  • <C-g> and <C-t> jump to the next/previous match while typing
  • Pairs well with hlsearch for complete search visibility
  • Neovim has inccommand for live preview of :substitute

Next

How do you yank a single word into a named register?