Jul 16

Turn off highlighting on vi (vim)

By agatewood Linux Comments Off on Turn off highlighting on vi (vim)

Recently, my vi editor (vim) began highlighting spaces and what it thought were keywords in files. This highlighting made the documents difficult to read and wasn’t needed. I’m fairly sure that I erroneously entered some command and caused this behavior. After a little googling, I found a couple of commands to turn this behavior off, specifically, ‘:set hls!’ and ‘:syntax off’. Those commands worked great until I exited vi and then opened another file. After a little searching, I found the following in /etc/vimrc:

” Switch syntax highlighting on, when the terminal has colors
” Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has(“gui_running”)
syntax on
set hlsearch
endif

Change this section to read (change on to off and remove hlsearch):

” Switch syntax highlighting on, when the terminal has colors
” Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has(“gui_running”)
syntax off
endif

Now the highlighting has disappeared. Hope this helps some others who only use vi out of necessity.

Tagged with:
preload preload preload