Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can vim recognize when it is used in Console2?

Tags:

vim

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!

like image 654
E.Beach Avatar asked Feb 18 '23 14:02

E.Beach


1 Answers

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.

like image 143
Ingo Karkat Avatar answered Feb 28 '23 00:02

Ingo Karkat