Friday, September 2, 2011

Re: Color Definition at VIM Invocation???

On Sat, 3 Sep 2011, Ken Schmitt wrote:

> I am currently using VIM version 5.7

Hmm. Good luck...


> 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.

:so ~/.vimrc

(from anywhere) should be equivalent. If you're in your home dir, you
can drop the '~/'. If nothing else works, at least save some
keystrokes.


> My .vimrc file content is:
>
> [...]
>
> 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.

The highlight commands don't work, presumably because the C syntax file
redefines them.

Does 5.7 have autocommands? If so, put 'em in a function that gets
called when editing files:

fun! LinkColorGroups()
highlight link cConditional VisualNOS
highlight link cRepeat VisualNOS
highlight link cStatement VisualNOS
highlight link cLabel VisualNOS
highlight link cStructure VisualNOS
highlight link cStorageClass VisualNOS
endfun

aug SetupColors
au!
au BufRead,BufNewFile * call LinkColorGroups()
aug END

--
Best,
Ben

--
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

No comments:

Post a Comment