why is vim calling this script on startup?

2

I'm trying to use a custom color scheme.

On startup, I can see that vim is loading my scheme, but after that it loads another scheme, overwriting mine.

Here's the output of :scriptnames:

  1: /usr/local/Cellar/macvim/7.4-72/MacVim.app/Contents/Resources/vim/vimrc
  2: ~/.vimrc
  3: ~/.vim/colors/torte2.vim
  4: /usr/local/Cellar/macvim/7.4-72/MacVim.app/Contents/Resources/vim/runtime/syntax/syntax.vim
  5: /usr/local/Cellar/macvim/7.4-72/MacVim.app/Contents/Resources/vim/runtime/syntax/synload.vim
  6: /usr/local/Cellar/macvim/7.4-72/MacVim.app/Contents/Resources/vim/runtime/colors/torte.vim
  7: /usr/local/Cellar/macvim/7.4-72/MacVim.app/Contents/Resources/vim/runtime/syntax/syncolor.vim
  ... and so on

As you can see, my colorscheme "torte2" is loaded in line 3, but then it's clobbered by "torte" in line 6.

Why is it doing that, and how can I make it stop?

Grant Birchmeier

Posted 2014-10-17T22:40:51.487

Reputation: 153

1

Can you share your colorscheme and your vimrc? Is this this one? If so you should change let g:colors_name = "torte" to let g:colors_name = "torte2".

– romainl – 2014-10-17T22:57:00.037

No, my torte2 is just a copy of the regular torte with some modifications I made. – Grant Birchmeier – 2014-10-18T07:08:26.760

Is it still called "torte" or did you change it to "torte2"? Also, where is your vimrc? – romainl – 2014-10-18T07:44:07.887

Answers

2

When you clone a colorscheme, you need to adapt the g:colors_name inside the script; its value must be identical with the changed name. That's because the following snippet of syntax/synload.vim will re-load the colorscheme:

" Set the default highlighting colors.  Use a color scheme if specified.
if exists("colors_name")
    exe "colors " . colors_name
else

You forgot to adapt the name, so Vim is re-loading torte.vim instead of your torte2.vim.


Alternatively, you can rename your cloned script to torte.vim; if it's earlier in the 'runtimepath', Vim will prefer that over the one that ships with Vim.

Ingo Karkat

Posted 2014-10-17T22:40:51.487

Reputation: 19 513

Ah, yep, that's exactly what I did. I didn't notice g:colors_name inside the scheme that I copied, so it still said 'torte'. As soon as I changed it to 'torte2', the problem resolved. Thanks! – Grant Birchmeier – 2014-10-19T02:24:40.593