0

How would I cause vim to startup with a different color scheme depending on whether or not I was connected via a PuTTY ssh session? I have a preferred color scheme that doesn't display correctly through putty, but I need to use putty sometimes when I'm connecting via public terminals.

Does PuTTY set any environment variables?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
markw
  • 620
  • 3
  • 14
  • I don't think so. What does the documentation say on that mattter? – romainl Oct 22 '12 at 05:35
  • Are you using the default color scheme that comes with PuTTY? If so consider switching to something like [Pretty PuTTY](https://github.com/jacktrocinski/pretty-putty). – Jacek Trociński Jun 08 '18 at 09:30

1 Answers1

1

Puty seems to be able to set environment variables via Configuration->connection->data.

After that, you could do, in the .vimrc:

if !empty($VARIABLE_PUTTY)
    colorscheme my_putty_color_scheme
else
    colorscheme my_default_color_scheme
endif
Nicolas
  • 598
  • 3
  • 15
  • That would still require typing something in, but I'll accept the answer. Guess I'll just find a color scheme that works well enough for both. – markw Oct 26 '12 at 18:54
  • *Configuration -> Data -> Terminal-type string* sets the `TERM` variable when connecting. I recommend setting this value to `putty-256color` to have 256 color support. – Jacek Trociński Jun 08 '18 at 09:34