Search code examples
vi

Linux - how to turn off space highlighting


I am working on a shell script but noticed that space character is unnecessarily highlighting which is very annoying.

enter image description here

Tried to turn it off by :syntax off but that removes highlighting for all. Please suggest how can I turn off the space highlight.


Solution

  • That looks like it might be highlighting the last search term. Try running :nohlsearch (or :noh for short).

    If you perform another search, highlighting will be enabled again. To disable search highlighting entirely, run :set nohlsearch (or :set nohls).

    Before I knew about the above commands, I used to search for a string that wouldn't exist in my file, for example /rhrp. That would make the highlighting effectively disappear.