Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

As my primary workstation, I use a mac running OS X 10.5. I spend much of the day ssh'd into remote systems and am working on grokking vim. One of the things I want to do is experiment with different colour schemes.

The problem I encounter is that my settings override the colours specified in the vim colour scheme. A very simple example is the background colour. If I pick, say, the 'desert' colour scheme in vim on the remote server the background should be black. If I then use Terminal preferences to set my background colour to an intense orange, my Terminal preference wins.

I want my Terminal preferences to win for local shells, but I want anything I specify on remote systems to win on them. Is that possible?

share|improve this question
Are you sure the colors actually arrive on your machine? – Daniel Beck Feb 24 '11 at 19:01
Not 100%. Changing which color scheme I'm using has a bit of impact though. Generally in places where there isn't a Terminal setting to override. For example if I switch to 'fog' the background where there is text changes to a near white color. – Rob Drimmie Feb 24 '11 at 19:28
I've tried changing the emulation (in Preferences->Advanced->Emulation "Declare terminal as:" from 'xterm-color' (the default) to xterm, ansi, vt100 and vt102 but can't see any difference in behaviour. – Rob Drimmie Feb 24 '11 at 19:34
I'd like to know this too! If there is I way. – romeovs Mar 22 '11 at 18:30
up vote 2 down vote accepted

[Update: As of Mac OS X Lion 10.7 Terminal supports both BCE and 256 colors.]

You're probably encountering two issues:

  1. Terminal doesn't support the Background Color Erase (BCE) model†. vim requires a BCE terminal in order to fill in the background color for blank areas.

  2. Terminal only supports the 16 ANSI colors, not the extended 256 color model. Some vim color schemes, such as "desert256", require 256-color support to select specific colors.

If you use the same setup in Xterm (run vim on a remote machine with your selected color scheme) and it behaves as expected, one or both of these is what you are encountering.

† BCE means that certain terminal control sequences like "erase to end of line" and "clear screen" will fill in the cleared areas with the currently selected text background color. Non-BCE terminal emulators display whatever static background they normally display. Some programs will detect whether the terminal supports BCE (via terminfo) and "manually" fill in blank areas with space characters, but vim does not.

(BCE exists to make it more efficient to fill in the background color in large areas of the display, and to eliminate unwanted space characters when copying text out of an emulator, for example. From what I've read, no physical terminal ever supported BCE, it's entirely a feature of some modern terminal emulators.)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .