vimconsole2

Can vim recognize when it is used in Console2?


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!


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.