Mac Vim Color


Question or issue on macOS:

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…

Then this…

To test a color scheme, in Vim editor, switch to command mode, and type:colorscheme newscheme. The “newscheme” is the.vim files in /.vim/colors/. Backlog markdown meaning.

MacVim tab color flickers on Leopard. Hi, when opening tabs or resizing the window, the color of the title bar changes color in strange ways. I worked around this with win. As far as colors go, I use MacVim's default, with a few minor tweaks and the background color set to LemonChiffon3 (sort of a light tan, much easier on the eyes than pure white).

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?

How to solve this problem?

Solution no. 1:

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

Solution no. 2:

Create vimrc file on your home folder and then edit it. You can try adding syntax on inside ~/.vimrc file.

It will highlight your code syntax on vim

Solution no. 3:

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:

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

Solution no. 4:

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 no. 5:


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

MacVim has great color schemes and you can still launch it from Terminal like so:

That will open your file in a new Vim window.

Solution no. 6:

@ashcatch – Can’t leave a comment, but wanted to add that iTerm has other advantages over 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.

Hope this helps!

Some combination of upgrading my mac os x or switching to fish shell caused my vim to be tricked into thinking the terminal is in dark mode all the time (so the colors were too light on the white background). I never found the root issue. I set out to find a way to determine if the current os configuration is in dark or light mode. This was a mess.

Mac Vim Editor Color

It seems you used to be able to issue defaults read -g AppleInterfaceStyle and it would report light or dark. Now, in catalina if you’re in “Auto” mode and it’s currently light, this command will fail with message:

This deterred me and I set out to find more robust way to find the dark mode status. I tried applescript:

This will return ‘true’ or ‘false’ for dark mode. But it’s so slow!! It takes about 0.1secs to return a value.


After digging around it seems that the exit status of defaults read -g AppleInterfaceStyle can actually be used reliable to determine light or dark mode. Even if you’re in “Auto” mode, this command exits successfully if and only if you’re actually in dark mode. So you can just ignore the output defaults read -g AppleInterfaceStyle >/dev/null 2>&1.

Mac Iterm2 Vim Color

This command is pretty fast but still about 20ms. Calling this in vim upon load/file open would feel a little sluggish. As a trick, I call it “after zero seconds”. This lets vim load the file and then instantaneously as it’s opened the background is set. As opposed to feeling the pause after issuing the open/load command:

Tags: catalina, dark mode, osx, vim