hlsearch VIM Command

How to use hlsearch Command in Linux VIM editor?

Explanation


hlsearch command is used to highlight every occurrence of the searched string.

Usage:

:set hlsearch

Example:

  • Open the file test.txt
    $ vim test.txt
  • To highlight the searched string.
    :set hlsearch
  • To search and highlight the string 'India' in the file.
    Enter /India
    hlsearch Vim Command

Ask Questions

Ask Question