On 02/09/11 21:19, Ken Schmitt wrote:
I am currently using VIM version 5.7 running on a HP-UX hp9000s800
workstation. I am running WRQ Reflection for UNIX and Digital Version
10.0 terminal emulation software in VAX VT220 in color mode on a PC
running Windows XP Pro.

When I start VIM I want to redefine some c language colors with the
highlight commands in the .vimrc startup file, but these commands are
ignored at startup. Once I am running, I can type

:.source .vimrc

In my home directory and the highlight commands are processed properly
and the colors are seen.

My .vimrc file content is:

set showcmd

set showmatch

set ignorecase

set incsearch

set autowrite

syntax on

set nocompatible

set tabstop=4

set textwidth=132

highlight link cConditional VisualNOS

highlight link cRepeat VisualNOS

highlight link cStatement VisualNOS

highlight link cLabel VisualNOS

highlight link cStructure VisualNOS

highlight link cStorageClass VisualNOS

The 6 highlight commands will not work at VIM invocation time.

Why does this not work at startup as having to type the “:.source
.vimrc” command every time I want to edit a file is counterproductive?

Regards

*/Ken Schmitt/*

You should not have to source your vimrc again. In fact, doing so may be part of the problem, since ":syntax on" earlier on clears anything you defined on the previous pass and sets the defaults again.

Another part of the problem might be using Vim 5.7, which is more than ten years obsolete, see the dates (from ftp://ftp.vim.org/pub/vim/patches/ ):
5.7.001  2000-06-25
5.7.030  2001-04-24
5.8.001  2001-06-04
6.0.001  2001-09-27
6.1.001  2002-03-30
6.2.001  2003-06-02
6.3.001  2004-06-09
6.4.001  2005-10-17
7.0.001  2006-05-19
7.1.001  2007-11-20
7.2.001  2008-08-17
7.3.001  2010-08-16
7.3.293  2011-09-02

(m.n.001 is actually the first bugfix for release m.n, listed because it's easier for me to find the dates of patchlevels than those of releases)

On Unix, you can compile Vim yourself, see
        http://vim.wikia.com/wiki/Getting_the_Vim_source_with_Mercurial
        http://users.skynet.be/antoine.mechelynck/vim/compunix.htm

If you don't have admin rights on the Unix system, you should convince an admin that it is more than time to upgrade his software. You might also (as a temporary stopgap measure, if you have access to a compiler) compile a modern Vim and install it in your $HOME directory.

On Windows, I recommend using the "Vim without Cream" distribution, available as an installer named gvim-<version>.exe from http://sourceforge.net/projects/cream/files/



Are you sure you want to change these colors only in C sources? Otherwise you could change the groups to which they are linked:

        hi! link  Conditional  VisualNOS
        hi! link  Repeat       VisualNOS

etc. (though defining them as aliases of VisualNOS sounds like a strange choice to me. Ah, well, there's no accounting for tastes.)

The exclamation mark is important: without it, new links for groups already defined will be silently ignored. But I'm not sure if it already existed in Vim 5.7. If it didn't, then use

        hi clear Conditional
        hi link  Conditional  VisualNOS
        hi clear Repeat
        hi link  Repeat       VisualNOS
etc.

However, the "right" way to do all this would be to define your own colorscheme. If you only want to define a few highlight groups and leave the rest at the default, you could let Vim define them: copy $VIMRUNTIME/colors/default.vim to $HOME/.vim/colors/ (creating any not-yet-existing directory as you go along), change the filename (keeping the .vim extension), and edit the file, adding your :hi commands in it (somewhere near the middle), and replacing "default" by the new basename of your file in the ":let colors_name" statement near the end. Any highlight groups that you don't define will remain at the Vim "factory default".

Then add a :colo[rscheme] statement in your vimrc to invoke that new colorscheme, see :help :colorscheme



Best regards,
Tony.
--
Earn cash in your spare time -- blackmail your friends

--
You received this message from the "vim_use" 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