Knowledge for the World

Highlight search terms in vim

By default, vim does not highlight search terms, and it can be difficult to find them in the document.

1

While editing a file in vim you can temporarily turn on the highlight search option by typing:

:set hlsearch

2

To automatically highlight search patterns in vim, first edit your .vimrc file:

vim ~/.vimrc

and then add this line:

set hlsearch