colorscheme get's sourced twice resulting in lost custom highlighting

Bug #17386 reported by Simon Morgan
6
Affects Status Importance Assigned to Milestone
vim (Ubuntu)
Fix Released
Medium
Ian Jackson

Bug Description

I had trouble with highlighting declerations in my .vimrc being lost when I
specified a colorscheme. Preben 'Peppe' Guldberg found the source of the
problem, here's what he had to say:

OK. I had a quick look at vim.out and see the following:

1) your vimrc is sourced and everything should be set up as you want it
2) $VIM/gvimrc is sourced
3) "syntax on" - eventually sourcing $VIMRUNTIME/syntax/synload.vim
4) your colour scheme is sourced again

In the last step, "i clear" is issued, clearing your highlighting.
Actually, your highlighting is only cleared because you also use a
colour scheme.

In my book, the $VIM/gvimrc could be improved. It contains a test that
reads

   if has("syntax") && (&t_Co > 2 || has("gui_running"))

I would change that to

   if has("syntax") && (&t_Co > 2 || has("gui_running")) && !syntax_on

which does not turn syntax on again, if it has already been done (by
you, eg. in your vimrc).

I also find the test for gui_running in a gvimrc redundant, but perhaps
the file is used as both a vimrc and a gvimrc.

Revision history for this message
Simon Morgan (sjmorgan) wrote :

Almost 4 months and still no response?

Revision history for this message
Matt Zimmerman (mdz) wrote :

We are dealing with thousands of bug reports at this time; regrettably yours was
overlooked.

Revision history for this message
Ian Jackson (ijackson) wrote :

Having read the vim documentation, it seems to me that it would be better simply
to replace `syntax on' with `syntax enable'. Can you check whether that works
for you ?

Revision history for this message
Simon Morgan (sjmorgan) wrote :

Nope. Unfortunately that still results in my custom highlighting being lost.

Revision history for this message
Ian Jackson (ijackson) wrote :

Could you supply (eg as an attachment) copies of your vim dotfiles ? Also, if
you could tell me what you see, and what you expect to see, that would be very
helpful.

Thanks.

Revision history for this message
Simon Morgan (sjmorgan) wrote :
  • vimrc Edit (1.6 KiB, application/octet-stream)

Created an attachment (id=3849)
vimrc

Revision history for this message
Simon Morgan (sjmorgan) wrote :

I expect to see trailing whitespace highlighted in red.

Revision history for this message
Simon Morgan (sjmorgan) wrote :

Wakey wakey.

Revision history for this message
Constantine Evans (cevans) wrote :

After testing this in Edgy with Simon Morgan's .vimrc, I've found that this has been fixed, probably because gvimrc no longer contains the commands noted in the description.

Changed in vim:
status: Unconfirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.