Eric M.
Eric M.

Reputation: 5549

Why is my vim theme not showing up in standard vim (not mvim)?

I use the made of code theme. I was previously using macvim but switched to standard vim and am not seeing my normal syntax highlighting. Is there a way to get it to work?

I've confirmed that :colorscheme is madeofcode, as well as echo $g:colors_name. Thanks.

Upvotes: 0

Views: 915

Answers (3)

Herbert Sitz
Herbert Sitz

Reputation: 22256

Sorry, wrote up answer below before I noticed in a comment that you are on OS x. That's a different ball of wax, I think, I recall seeing fairly long SO thread on this issue for terminals on OS X. . . although this thread seems to indicate my solution works using iTerm: iterm vim colorscheme not working


This may also work, and is preferable to changing your terminal type. Just put the line below in your vimrc before any colorscheme command. Your xterm should support 256 colors, at least mine in Ubuntu does:

let &t_Co=256

That should fix the problem if the problem is xterm defaulting to too few colors, which you can confirm by doing :echo &t_Co in your terminal before applying fix above. If it's currently a number less than 256 then it should help.

I think the help section on color-xterm quoted in another answer must be old. My xterm on Ubuntu supports 256 as long as I do set t_Co=256 or equivalent let statement above, and Wikipedia indicates that xterm supports 256 colors:

http://en.wikipedia.org/wiki/Comparison_of_terminal_emulators

http://en.wikipedia.org/wiki/Xterm

Upvotes: 0

romainl
romainl

Reputation: 196809

Type :echo &term to know your &term, try $ echo $TERM in Terminal.app too to see if it's the same, just in case.

The $TERM/&term you need is xterm-256color.

You either set it from Terminal.app's preferences or from within Vim, like in sehe's answer, or as an argument when actually lauching Vim: vim -T xterm-256color.

Beware, though, trying to use a different terminal type than the one declared by Terminal.app will most definetly mess up with lots of things including colour and keymaps.

Upvotes: 0

sehe
sehe

Reputation: 393694

then it is probably showing, but you might

  • not have defined ctermfg, ctermbg etc. (just guifg/guibg)
  • the terminal might not be capable of displaying all the colours

See also

16. Color xterms *xterm-color* *color-xterm*

Most color xterms have only eight colors.  If you don't get colors with the
default setup, it should work with these lines in your .vimrc: >
   :if &term =~ "xterm"
   :  if has("terminfo")
   :  set t_Co=8
   :  set t_Sf=<Esc>[3%p1%dm
   :  set t_Sb=<Esc>[4%p1%dm
   :  else
   :  set t_Co=8
   :  set t_Sf=<Esc>[3%dm
   :  set t_Sb=<Esc>[4%dm
   :  endif
   :endif
< [<Esc> is a real escape, type CTRL-V <Esc>]

You might want to change the first "if" to match the name of your terminal,
e.g. "dtterm" instead of "xterm".

Note: Do these settings BEFORE doing ":syntax on".  Otherwise the colors may
be wrong.

Upvotes: 1

Related Questions