Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Red highlight in vi?

Status
Not open for further replies.

PTO1

MIS
Oct 1, 2004
4
US
Ok I am modifying a file and when I was changing some of the settings I inadvertently did something to highlight some of the text. Actually the highlight is not red, more of an orange/maroon color. Here is an example of what I am seeing; this is from /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=blah123

HOSTNAME is the portion highlighted. This is not causing any problems but I want to know what I did and how to undo it.

thanks

 
Sounds like you or someone else did a search for the string HOSTNAME while in vi (or vim). I would just vi the file and do a search for a string that doesn't exist, like

/foo

Chances are the HOSTNAME text will become unhighlighted since it won't match any text.

If this doesn't work please post back.

HTH
-bp
 
Thanks Blainepruitt your solution worked.

D.
 
That solution works until you have a file that has "food" or "snafoo" in it, and then you have the annoying highlighting back.


For the preferred solution, use [tt]:nohlsearch[/tt] (or just [tt]:noh[/tt]). That turns off highlighting until you search again.

To permenently turn search hightlighting off, use [tt]:set hlsearch=off[/tt]. That goes in your [tt]~/.vimrc[/tt] (without the starting colon) unless you feel like typing it every time you start vi.


(Note: I'm assuming that when you say "vi," you really mean "vim." If you're really using vi, some things like the config file name will probably be different for you.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top