4

With Steven Harman's Solarized tweak for Console2 I can more or less use the Solarized color scheme in win32 vim. But once in a while I find myself in vim via a vanilla cmd.exe window and the Solarized 16-color colorscheme is not aligned to it gui equivalent.

So I'd like to fix this inside my vimrc, but how can I check if console vim is being used in Console2?

Thanks!

E.Beach
  • 1,829
  • 2
  • 22
  • 34

2 Answers2

8

In Console2, you can set arbitrary environment variables by modifying the shell invocation (from the Settings dialog, or directly in the XML config). For the default Windows command prompt, use a value of:

cmd.exe /K set EMULATOR=console2

For Cygwin Bash, something like this should work:

C:\cygwin\bin\bash.exe -c "export EMULATOR=console2; exec /bin/bash -i"

Then, check for the $EMULATOR value in a conditional in your .vimrc, as outlined by romainl's answer.

Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324
0

See if your terminal emulator sets an environment variable or if you can set one in one way or another.

In bash, one would do:

$ export EMULATOR=console2

With that out of the way, you can put something like this in your _vimrc:

if $EMULATOR == "console2"
  colorscheme foo
else
  colorscheme bar
endif
romainl
  • 186,200
  • 21
  • 280
  • 313
  • Unfortunately Console2 doesn't appear to set any environment variables and I don't know how to make it do so. I'm interested as well if anyone can figure out how to detect it... – Dan Fitch Nov 05 '12 at 17:11