I'm using uxterm and vim with the following .vimrc: https://github.com/dbrgn/dotfiles/blob/master/.vimrc

When I open a file in vim and don't push any key, colored text is rendered using bold font and the Powerline status line doesn't use any colors.

Screenshot 1

As soon as I push a key (e.g. by switching to insert mode, moving the cursor or pressing EscEsc), the syntax highlighting becomes correct and the Powerline colors show up.

enter image description here

This behavior isn't limited to Python files, it also happens with .txt files which don't use any syntax highlighting. Is this a bug or a misconfiguration in my .vimrc?

Edit: I tried the same thing even with a .vimrc that only contained "syntax on", nothing else. Even then the syntax highlighting colors changed after pressing a key for the first time. This must be either a bug or a missing config variable.

  • Try placing set term=xterm-256color in your ~/.vimrc. – Rain Mar 29 '13 at 15:54
  • @Rain Great, that solves the problem! If you post this as a regular answer (preferrably with an explanation why the problem occurs) I can give you the bounty. – Danilo Bargen Mar 29 '13 at 16:32

Try placing

set term=xterm-256color

in your ~/.vimrc file and see if it helps.

From my understanding the, problem occurs because when Vim first launches it reads the $TERM environment variable and displays the interface in a "safe" manner to insure that everything it sends to the terminal (all of the escape codes) is supported and all the text will be readable. When the user causes a screen update (by pressing a key, switching modes, ect), it asks the terminal what features it actually supports and then re-displays everything with all of the extra features enabled.

Setting term to xterm-256color forces Vim to assume that some of the more advanced escape codes (colored backgrounds, bold/italics, ect) are supported before querying the terminal.

  • Thanks for your answer. Apparently I can only award the bounty 24 hours after posting it. You'll get it tomorrow. – Danilo Bargen Mar 29 '13 at 17:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.