tags:

views:

257

answers:

4

I was inspired by this (number 2) to make my hard-coded strings ugly.

How can I do this in VIM?

Thanks!

A: 

Many of the color schemes that come with VIM already do this. You can easily make them uglier if you like. :)

Brian Neal
Doesn't really address the "How can I..." bit of the question, more the "Can I..." :-)
paxdiablo
Give me a break. Ok, here ya go. Start up Vim. Go to the edit menu. Choose color schemes. Now try the various schemes until you find one that highlights strings. A lot of them do. Here is one: morning.
Brian Neal
sounds like gvim... not vim
ThomasGHenry
Correct. I guess I didn't answer your question then. But, unless you are ssh'ed into another box, why would you use vim over gvim? :)
Brian Neal
+4  A: 

In your .vimrc:

highlight String guifg=1 guibg=11
Paul Beckingham
hm... this might be setup dependant. that doesn't work for me. You may have given me enough to hunt and peck my way through it though. Thanks!
ThomasGHenry
That assumes gvim. For the command-line version, use ctermfg and ctermbg. Plus, you need to tuen syntax highlighting on.
Paul Beckingham
whew! that's heinous! Thanks :)
ThomasGHenry
A: 
highlight clear String
highlight link String Error

A bit over the top IMO, so you might want to not make it permanent.

Ant P.
+4  A: 

The language-based files are stored in $VIMRUNTIME/syntax, one .vim file per language, so that's where you need to go to change things.

For example, my C file is stored in C:\Program Files\Vim\vim70\syntax\c.vim and, if you add the following line near the end, before the let b:current_syntax = "c", you'll get the exact effect you require:

hi String guifg=#ff0000 guibg=#ffff00

For text-based VIM, the ctermfg and ctermbg options need to be used instead, something like:

hi String ctermfg=Red ctermbg=Yellow

I haven't tested these since I only use gvim nowadays.

paxdiablo