Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I installed vim-gnome on ubuntu. I notice that things I put in my $HOME/.vimrc file, like colorscheme and so on, are being overwritten by something else. If I start Vim, another colorscheme is used, but if I then do ":source ~/.vimrc", the settings that I want load properly.

Here's my .vimrc:

set t_Co=256
set paste
set number
syntax on
colorscheme zenburn

When I do :scriptnames, I see what seems to me to be a lot of things being run on startup (it takes a couple of seconds too...):

  1: /usr/share/vim/vimrc
  2: /usr/share/vim/vim72/debian.vim
  3: /usr/share/vim/vim72/syntax/syntax.vim
  4: /usr/share/vim/vim72/syntax/synload.vim
  5: /usr/share/vim/vim72/syntax/syncolor.vim
  6: /usr/share/vim/vim72/filetype.vim
  7: /etc/vim/vimrc.local
  8: /home/tom/.vim/colors/zenburn.vim
  9: /home/tom/.vimrc
 10: /usr/share/vim/vim72/syntax/nosyntax.vim
 11: /home/tom/.vim/plugin/CSApprox.vim
 12: /home/tom/.vim/plugin/Light.vim
 13: /home/tom/.vim/plugin/codeburn.vim
 14: /home/tom/.vim/colors/Light.vim
 15: /home/tom/.vim/autoload/csapprox.vim
 16: /home/tom/.vim/plugin/coffee.vim
 17: /home/tom/.vim/plugin/color_sample_pack.vim
 18: /home/tom/.vim/plugin/ir_black.vim
 19: /home/tom/.vim/colors/coffee.vim
 20: /usr/share/vim/vim72/plugin/getscriptPlugin.vim
 21: /usr/share/vim/vim72/plugin/gzip.vim
 22: /usr/share/vim/vim72/plugin/matchparen.vim
 23: /usr/share/vim/vim72/plugin/netrwPlugin.vim
 24: /usr/share/vim/vim72/plugin/rrhelper.vim
 25: /usr/share/vim/vim72/plugin/spellfile.vim
 26: /usr/share/vim/vim72/plugin/tarPlugin.vim
 27: /usr/share/vim/vim72/plugin/tohtml.vim
 28: /usr/share/vim/vim72/plugin/vimballPlugin.vim
 29: /usr/share/vim/vim72/plugin/zipPlugin.vim

I guess some of these are overriding the things loaded from .vimrc. (CSApprox is one that I have in my .vim/plugins, but most of the others I haven't "chosen" to run at startup.

How can I change this so that what's in .vimrc overrules the other stuff? (Or, how can I stop so much stuff from being run at startup?)

share|improve this question

2 Answers 2

up vote 1 down vote accepted

It looks like this part of the scriptnames output is relevant:

12: /home/tom/.vim/plugin/Light.vim
13: /home/tom/.vim/plugin/codeburn.vim
14: /home/tom/.vim/colors/Light.vim
15: /home/tom/.vim/autoload/csapprox.vim
16: /home/tom/.vim/plugin/coffee.vim
17: /home/tom/.vim/plugin/color_sample_pack.vim
18: /home/tom/.vim/plugin/ir_black.vim
19: /home/tom/.vim/colors/coffee.vim

It looks like you have some colorschemes in your plugin directory (Light.vim, codeburn.vim, ...). Try moving these to a temporary location and see it it helps.

share|improve this answer
    
Yes, doing this solved the problem. Thanks a lot!! –  Tancata Feb 26 '11 at 18:41
    
@Tancata: colorscheme files belong in your /home/tom/.vim/colors directory. –  garyjohn Feb 26 '11 at 19:38

The only place in the standard VIM files where t_Co is set is /usr/share/vim/vim72/debian.vim and setting t_Co in my .vimrc works fine.

I notice you have a number of files listed there in your ~/.vim folder which run after your .vimrc - I would suspect that one of these has t_Co being set in it.

$ grep -r 'set t_Co' .vim/*

should tell you which file it is that's overriding your setting.

share|improve this answer
    
t_Co is not the colorscheme, it's the number of colors supported by the UI. –  grawity Feb 26 '11 at 17:56
    
When Vim starts, it determines the value of the TERM environment variable, then sets the value of t_Co from the value of Co in the terminfo database. –  garyjohn Feb 26 '11 at 18:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.