How can I activate Vim color schemes in OS X's Terminal?

MacosVim

Macos Problem Overview


I'm working with the Vim 7.2 that comes with Mac OS 10.6.1 (Leopard), using the Mac's "Terminal" app. I'd like to use a fancy color scheme. I did this...

:syntax on

Then this...

:colorscheme slate

:colorscheme elflord

:colorscheme desert

etc...

Syntax highlighting is working, but I'm finding that regardless of the scheme I choose, the only colors displayed are the basic Red, Blue, Cyan, Gray, etc.

Is there a way to get the Terminal app to display a larger collection of colors to allow some more subtle schemes?

Macos Solutions


Solution 1 - Macos

Create a .vimrc file on your home ~/ folder and then edit it with vim ~/.vimrc. You can try adding syntax on inside ~/.vimrc file. The following command does that:

echo "syntax on" >> ~/.vimrc

It will highlight your code syntax on vim

Solution 2 - Macos

You need to create file ~/.vimrc and add syntax on in that file

> vi ~/.vimrc > > syntax on

save the file and run your vim

Solution 3 - Macos

Add "syntax on" to the file /usr/share/vim/vimrc and you'll get highlighting in your files every time you edit one.

# vi /usr/share/vim/vimrc

Add this line at the end of the file:

syntax on

Now you'll get highlighting when you edit whatever's file.

Solution 4 - Macos

The Terminal.app supports AFAIK only 16 colors; iTerm supports more colors or you use mvim (as suggested by Daniel).

Solution 5 - Macos

You might want to consider using a version of Vim that is a native Mac app (that runs in a window).

http://code.google.com/p/macvim/">MacVim</a> has great color schemes and you can still launch it from Terminal like so:

$ mvim file.txt

That will open your file in a new Vim window.

Solution 6 - Macos

@ashcatch - Can't leave a comment, but wanted to add that iTerm has other advantages over Terminal.app such as sensible copy and paste (configurable 'word' regex for easy double click selection of paths/urls, middle click paste) and terminal mouse support (:se mouse=a in vi to get mouse text selection, moving of window borders etc.)

I'd be lost without it.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionEthanView Question on Stackoverflow
Solution 1 - Macosskipper21View Answer on Stackoverflow
Solution 2 - MacosynzView Answer on Stackoverflow
Solution 3 - MacosjotacorView Answer on Stackoverflow
Solution 4 - MacosashcatchView Answer on Stackoverflow
Solution 5 - MacosDaniel WorthingtonView Answer on Stackoverflow
Solution 6 - MacosrobinceView Answer on Stackoverflow