2

I want the result to be highlighted when I search for it in a file.So,I opened a file with vi(version 7.2) and then used command :set hlsearch to enable highlighting.But even then I don't get my search results highlighted.Any idea what else to check ?

Edit

Now I tried same thing with vim and it works fine there.Is hlsearch only for vim ?

g4ur4v
  • 1,764
  • 8
  • 29
  • 34

1 Answers1

1

The Vi version 7.2 that you refer to may be Vim 7.2 (on some systems vi is actually vim). If it's actually Vim, the hlsearch setting should be in there unless it's been compiled without the extra_search feature. This feature is not available if Vim has been compiled with its "tiny" or "small" feature set.

It's strictly a Vim feature, not available in Vi.

Typing :help hlsearch in Vim 8.0 gives me

'hlsearch' 'hls'        boolean (default off)
                        global
                        {not in Vi}
                        {not available when compiled without the
                        +extra_search feature}

My guess is that vi on your system is actually Vim compiled with a small or tiny feature set, while vim is Vim compiled with a larger feature set.

Kusalananda
  • 333,661