6

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?

enter image description here

2
  • It won't be the same, but it looks like your cygwin vim thinks it is on a light background - does :set bg=dark do anything?
    – Random832
    Commented Mar 9, 2015 at 19:41
  • On Windows, I personally think that the only way to get a development environment that you can use on daily basis is to use GVim. DOS, Powershell and Cygwin or the Linux subsystem lack niceties that come as standard with a linux command prompt. Even though 256 colour support is supposed to be included in Windows 10 now, you still lack bold and italic fonts.
    – icc97
    Commented Nov 22, 2017 at 17:35

2 Answers 2

8

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.

4
  • 3
    Probably worth pointing out that 256 colours is still a lot less than that offered by GUI Vim.
    – Rich
    Commented 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
3

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.

1
  • 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 and guibg defined for the various highlight definitions. Thanks! Commented May 28, 2015 at 10:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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