简体   繁体   中英

Vim background color doesn't render properly in GNOME terminal

Vim背景问题

I'm guessing lots of people get this problem, but I can't seem to find any other threads/questions about it anywhere. I guess it's difficult to capture in keywords.

Basically, Vim doesn't draw the background color when scrolling up in places where there is no text. I've also seen it on my friend's Mac, so it's not peculiar to my setup.

I have a pretty big vimrc, but I get the same problem without a vimrc and setting :colorscheme blue.

I'm using gnome-terminal on Ubuntu 11.10 (Oneiric Ocelot). It's a fairly clean install that I set up only a few days ago, so there's not really any funny business going on. I expect this would happen out of the box.

I've not had this problem in other contexts eg over SSH with PuTTY or previous versions of Ubuntu which I'm guessing was also gnome-terminal.

What's going on?

In Linux I had export TERM=xterm-256color in my .bashrc . That caused Vim to look like this (after setting set t_Co=256 ):

在修复TERM变量之前,Vim用molokai主题看

When I removed that line from my .bashrc and opened a new terminal ( exec bash didn't do it). This is what I get (you need to have set t_Co=256 ):

在修复TERM变量后,Vim以molokai主题看起来

Try running :set t_Co=256 (replacing 256 with the value corresponding to the number of colors your terminal supports). A similar looking (though less conspicuous) problem of mine was caused by using too few of the available terminal colors in Vim. To figure out how many colors your terminal supports, see this .

I had to do two things:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM