8

I'm having a problem similar to VIM Color scheme not loading by default

Except I am having the problem with the gentooish theme found here http://www.vim.org/scripts/script.php?script_id=2474

For some reason macvim refuses to load this colorscheme by default.

My vimrc file is as follows, I do not have a .gvimrc file.

:set term=xterm-256color
:set t_Co=256
set background=dark
colorscheme gentooish

But once I have macvim opened if I do :colorscheme gentooish it will load fine. Also it does load by default if I type vim on the command line. It just won't load by default in macvim.

Any ideas?

Community
  • 1
  • 1
Marcello
  • 156
  • 1
  • 2
  • 7

2 Answers2

19

MacVim loads its own default gvimrc file, which applies a default colorscheme. Since gvimrc files are processed after vimrc files, the colours of your :colorscheme instruction are overwritten by the ones from the default gvimrc.

There are two solutions: Create your own gvimrc file and put the colorscheme command there:

$ cd
$ echo "colorscheme gentooish" > .gvimrc

Alternatively, put the following line in your vimrc, which prevents MacVim from applying its own colorscheme (see :h macvim-colorscheme).

let macvim_skip_colorscheme = 1
glts
  • 21,808
  • 12
  • 73
  • 94
  • Thanks guys, creating a .gvimrc with colorscheme gentooish worked! – Marcello Feb 11 '13 at 01:07
  • 3
    That's absolute nonsense. I have been using MacVim for more than two years with `colorscheme somename` in my `~/.vimrc`, no `~/.gvimrc` and no `let macvim_skip_colorscheme = 1` without a single colorscheme issue. – romainl Feb 11 '13 at 07:43
  • 2
    @romainl I also have an older MacVim where it just works as it does for you. The `macvim_skip_colorscheme` variable seems to be a new-ish addition. – glts Feb 11 '13 at 09:20
  • I have been runnning the latest snapshot 66 (7.3.754) since two weeks and have been running snapshot 64 for a few months before and other forgotten builds for 2 years without ever encountering any colorscheme issue. Do you have the same issue as the OP? – romainl Feb 11 '13 at 09:42
  • @romainl Interesting. I always had my `:colorscheme solarized` command in my gvimrc as I feel that's the proper place for MacVim, and it works, of course. So to answer your question, no, we both don't have the issue OP had. – glts Feb 11 '13 at 10:08
  • I had to use `macvim_skip_colorscheme` when the theme was not properly setting the `g:colors_name` value properly. Fixing this in the theme solved the issue. – ericbn May 04 '17 at 23:58
5
  1. : is not needed in your ~/.vimrc.

  2. term and t_Co are terminal-specific options. MacVim being a GUI for Vim doesn't care about them. If you don't use Vim in a terminal, those two lines are not needed.

  3. set background=dark makes Vim do a few hardly noticeable but nifty things: it is set by Vim automatically and generally overwritten by your colorscheme. You can safely drop it from your ~/.vimrc.

Just to make sure we are on the same boat, could you confirm that:

  • your .vimrc path is ~/.vimrc?
  • your colorscheme path is ~/.vim/colors/gentooish.vim?
romainl
  • 186,200
  • 21
  • 280
  • 313