Question

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!

Was it helpful?

Solution

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.

OTHER TIPS

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top