I installed Cygwin/x on my PC, and I've set the terminal to xterm-256. But when I start vim from cygwin terminal, the look and feel of the same color scheme is different on cygwin and gvim. gvim always looks more pleasant, more clear. How can I make the look and feel of vim in cygwin be the same as gvim?
2 Answers
Cygwin terminal limitations
The default Cygwin terminal is based on the Windows console and inherits its limitations (very few colors, no font styles like bold or italic). You can find out how many colors are available to Vim via
:set t_Co?
For me, that gives a meager 8
. To get 256 colors, you need to use a terminal emulator that support high colors, e.g. PuTTY:
putty.exe -ssh localhost
Need colorscheme with terminal support
Of course, all of this assumes you've chosen a colorscheme that actually supports color terminals. This is the case if the :highlight
output contains ctermfg=
/ ctermbg=
definitions, not just ones starting with gui
.
What if you have a GUI-only colorscheme (but you like it)? Plugins like CSApprox can take the GUI color definitions and convert them to a closely matching 256-color cterm
color palette for high-color terminals. This helps with colorschemes that otherwise only pick from the bland default 16-color terminal color palette, or only provide GUI color definitions.
Another approach is taken by csexact, which modifies the (supported) terminal's palette to exactly match Vim's GUI colors.
-
3Probably worth pointing out that 256 colours is still a lot less than that offered by GUI Vim.– RichCommented Mar 10, 2015 at 15:20
-
This answer is missing the very important fact from the other answer. Most color schemes simply seem to be made for the GUI version of Vim, rather than the terminal version. Many of those color schemes will not even contain a definition for the terminal version and thus they don't appear to work. Commented May 28, 2015 at 10:50
-
@0xC0000022L: Thanks for the feedback; judging from the screenshot, this might very well be the case here. I've added corresponding instructions to my answer. Commented May 28, 2015 at 11:05
-
@IngoKarkat: great edit. Thanks. I wish I could upvote it once again. Commented May 28, 2015 at 12:51
When I started with Vim something that droves me crazy was this issue, I see pretty colors on gVim but ugly ones on vim in the console. What you need to know is that in the color schemes there are special params defined for console and for GUI. This is because basic limitations on the colors that common consoles can display.
For example, look at this line in the github color scheme:
hi LineNr ctermfg=246 ctermbg=15 guifg=#959595 guibg=#ECECEC gui=bold cterm=bold
This means that it will display a "more precise" color for the background on gui (look at guibg=#ECECEC) than on console vim (just a plain almost white "15").
Maybe this doesn't resolve your issue, but you should understand this point about Vim on console versus on GUI.
-
this, along with the comment from the other answer should be the accepted one. Spot on. We had the same issue with a colleague and then I noticed his chosen color scheme only had
guifg
andguibg
defined for the varioushighlight
definitions. Thanks! Commented May 28, 2015 at 10:48
:set bg=dark
do anything?