The proper way of specifying highlights is with a colors file, which on mac
should be in ~/.vim/colors/foo.vim, where foo is the name of the
colorscheme.  Then you do 'syntax on' and 'color foo' in your .vimrc, and
everything should work.  Note that the colors files have to set
colors_name, so you'll want to make sure this is in your color file:
:let g:colors_name="foo"

You probably also want to guarantee vim understands the background color by
having "set background=dark" (if it's dark) in the colorscheme file as well.

This is supported on all the platforms and is the "proper" way to specify
the colors so that it survives a :syntax off|syntax on.  If you want to
investigate some of the included colorschemes, check out: :e
$VIMRUNTIME/colors/desert.vim.

To explain bjorn's answer a bit more:
The gvimrc that comes with vim is loaded before yours (but after your
.vimrc).  You can see a copy of this file by opening it with: :e
$VIM/gvimrc (no leading period on the file name).  At the top it sets the
default macvim color scheme, which is what's interfering with you.


On Sun, Jan 8, 2012 at 8:55 AM, Bee <beeyaw...@gmail.com> wrote:

>
>
> On Jan 8, 8:07 am, björn <bjorn.winck...@gmail.com> wrote:
> > On 8 January 2012 00:00, Bee wrote:
> >
> >
> >
> >
> >
> > > I have found a 'problem' with the highlight command in MacVim.
> > > MacVim snapshot 53 -- osx 10.4.11
> > > MacVim snapshot 60 -- osx 10.6.8
> >
> > > Neither one respects a gui highlight in .vimrc such as:
> >
> > > highlight Visual NONE ctermbg=Yellow ctermfg=Blue cterm=Bold
> > > guibg=Yellow guifg=Blue gui=Bold
> >
> > > The same .vimrc works on MacOS with MacPorts gui vim-app 7.3.353 !
> > > The same .vimrc works on WinXP with gvim 7.3.386 !
> > > The same .vimrc works on Linux with gvim 7.3.372 !
> >
> > > Since I do not have Lion, and will not any time soon, I can not test
> > > more a recent snapshot.
> >
> > > ** Will this be or has this been changed or fixed? **
> >
> > > I have added the gui highlight commands to .gvimrc and they work.
> >
> > > It is just more convenient for them to be in the same highlight
> > > command.
> >
> > You should be able to work around this issue by adding the line
> >
> > let colors_name = "mine"
> >
> > to your ~/.vimrc file (substitute "mine" for whatever you like).
> >
> > The reason why you have to do this is that if colors_name is not set
> > MacVim assumes the color scheme hasn't been modified and sets its own
> > custom color scheme.
> >
> > Björn
>
> Thank you for the suggestion.
> At first I thought that worked, statusline, linenr, incsearch now all
> work.
>
> But then I tried to turn on/off syntax highlighting and got an error
> message:
>
> E185: Cannot find color scheme mine
>
> If I use a .gvimrc for the gui highlight commands, all my colors work.
>
> Ah but for one glitch, if I toggle syntax highlight (which works), the
> linenr and statusline change to something else (not mine).
>
> None of this happens on MacOS gui vim-app, Linux gvim, WinXP gvim,
> MacOS terminal vim, or Linux terminal vim.
>
> Bill
>
> --
> You received this message from the "vim_mac" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>

-- 
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to