Revision as of 08:00, October 17, 2013

I am using PuTTY in Windows to access a Unix box, and the Terminal-type string in PuTTY is set to xterm. I wanted to use Vim's color schemes. I tried many different things with no decent result until I found the following code in Vim's help. After inserting the following lines in my vimrc, I was able to use all the color schemes defined by Vim.

See also

Comments

It is relatively easy to change the TERM setting PuTTY uses to set it to send it as "xterm-256color" (or install the full set of terminfo files and set it to the proper setting of "putty-256color". -- PuTTY doesn't support Techtronix mode and so is not fully xterm compatible.)

In PuTTY this is changed in the Configuration in the Connection -> Data section. This is the same preferences page where you specify your auto-login username, so you should be visiting this page anyway. With your auto-login username specified, and public key authorization (which you should be using) and a key agent running (PuTTY's Pageant does this) you can select a host and log in without being prompted for username or password.

With your TERM set to anything close to accurate, you can then leverage all 256 colors in other applications without manually tweaking the settings for every application.

I often use PuTTY at work to connect to a solaris box which we use for compiling code. I have no admin rights, and no knowledge of how to set up terminfo, etc. I tried the PuTTY setting you give, but I just get a "using dumb terminal mode" message on login, and Vim has no colors. The 256-color workaround in this tip works fine. I don't like it, I'd rather do it "the right way" but sadly this may not be an option for me. Unless there's something I can do in my own user space to get the terminfo correct. --Fritzophrenic 19:28, December 9, 2010 (UTC)

Chances are your system doesn't use terminfo then. Try hardwiring your term option like this:

set term=builtin_xterm

or

set term=builtin_ansi

That should give you colors in putty. Your vim needs to be compiled with +builtin_term (+ or ++), though.

Thanks for the suggestion. I have +builtin_terms (not ++builtin_terms) but neither :set term=builtin_xterm nor :set term=builtin_ansi have any noticeable effect to enable colors, even when it is the first item in the .vimrc (after :set nocompatible). Since the hack in this tip does work for me, and I really don't know much about terminal configuration, I'm probably going to just leave it. --Fritzophrenic 14:24, December 10, 2010 (UTC)

It works for me with putty. But I need to explicitly set :syntax on after setting 'term' to builtin_ansi. 217.88.63.38 13:20, December 11, 2010 (UTC)

Try to set Terminal-type string in putty (Connection->Data) to 'putty-256color'. That worked for me.