Macos – GNU screen changes vim syntax highlighting colors

colorsgnu-screeniterm2macosvim

I am trying to use vim inside a GNU screen session, but whenever I open vim inside screen the syntax highlighting uses completely different colors when compared to when I open vim outside GNU screen.

Why does vim change its syntax highlighting colors when I open it inside screen and how do I fix it?

Note: I am using spf13-vim in iTerm2 (OS X).

Edit: these two images show the difference when using vim in the normal bash and when using it inside screen:

  • Normal:
    Normal vim

  • Inside screen:
    vim inside screen

Best Answer

I had similar symptoms, except that it happened for all programs not just vim. The resolution for me was to install a newer version of screen (I was using GNU screen as the backend for byobu.) I installed screen using Macports "port install screen" but I assume any method would suffice.

On my system, /usr/bin/screen --version reported 4.00.03 (FAU) 23-Oct-06. But the new screen reports 4.02.01 (GNU) 28-Apr-14. I cannot confirm whether the version upgrade was the key step, or whether the Macports screen is somehow configured differently.

Related Question